/**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('subscribe')) {
         MbqError::alert('', "Not support module subscribe!", '', MBQ_ERR_NOT_SUPPORT);
     }
     if (!MbqMain::$oMbqConfig->moduleIsEnable('forum')) {
         MbqError::alert('', "Not support module forum!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
     if ($oMbqEtForumTopic = $oMbqRdEtForumTopic->initOMbqEtForumTopic($in->topicId, array('case' => 'byTopicId'))) {
         $oMbqAclEtForumTopic = MbqMain::$oClk->newObj('MbqAclEtForumTopic');
         if ($oMbqEtForumTopic->isSubscribed->oriValue) {
             $this->data['result'] = true;
             return;
         }
         $aclResult = $oMbqAclEtForumTopic->canAclSubscribeTopic($oMbqEtForumTopic);
         if ($aclResult === true) {
             //acl judge
             $oMbqWrEtForumTopic = MbqMain::$oClk->newObj('MbqWrEtForumTopic');
             $result = $oMbqWrEtForumTopic->subscribeTopic($oMbqEtForumTopic);
             if ($result === true) {
                 $this->data['result'] = true;
                 $oTapatalkPush = new TapatalkPush();
                 $oTapatalkPush->callMethod('doInternalPushNewSubscription', array('oMbqEtForumTopic' => $oMbqEtForumTopic));
             } else {
                 $this->data['result'] = false;
                 $this->data['result_text'] = $result;
             }
         } else {
             MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Need valid topic id!", '', MBQ_ERR_APP);
     }
 }
예제 #2
0
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('user')) {
         MbqError::alert('', "Not support module user!", '', MBQ_ERR_NOT_SUPPORT);
     }
     if (MbqMain::$oMbqConfig->getCfg('user.inappreg')->oriValue != MbqBaseFdt::getFdt('MbqFdtConfig.user.inappreg.range.support')) {
         MbqError::alert('', '', '', MBQ_ERR_APP);
     }
     $oMbqWrEtUser = MbqMain::$oClk->newObj('MbqWrEtUser');
     $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
     $oMbqEtUser = $oMbqRdEtUser->initOMbqEtUser($in->email, array('case' => 'byEmail'));
     if (isset($oMbqEtUser)) {
         $this->data['result'] = false;
         $this->data['result_text'] = 'The email is already in use';
         return;
     }
     $oMbqEtUser = $oMbqRdEtUser->initOMbqEtUser($in->username, array('case' => 'byLoginName'));
     if (isset($oMbqEtUser)) {
         $this->data['result'] = false;
         $this->data['result_text'] = 'The username is already in use';
         return;
     }
     $this->oMbqEtUser = $oMbqWrEtUser->registerUser($in->username, $in->password, $in->email, false, array(), array(), $this->errors);
     $this->data['result'] = $this->oMbqEtUser != null;
     if (isset($this->errors) && empty($this->errors) == false) {
         foreach ($this->errors as $key => $value) {
             $this->data['result_text'] = (isset($this->data['result_text']) ? $this->data['result_text'] : '') . $value . PHP_EOL;
         }
     }
     if ($this->data['result']) {
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doAfterAppLogin', $this->oMbqEtUser->userId->oriValue);
     }
 }
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('forum')) {
         MbqError::alert('', "Not support module forum!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqEtThank = MbqMain::$oClk->newObj('MbqEtThank');
     $oMbqEtThank->key->setOriValue($in->postId);
     $oMbqRdEtForumPost = MbqMain::$oClk->newObj('MbqRdEtForumPost');
     if ($oMbqEtForumPost = $oMbqRdEtForumPost->initOMbqEtForumPost($oMbqEtThank->key->oriValue, array('case' => 'byPostId'))) {
         $oMbqAclEtForumPost = MbqMain::$oClk->newObj('MbqAclEtForumPost');
         $aclResult = $oMbqAclEtForumPost->canAclThankPost($oMbqEtForumPost);
         if ($aclResult === true) {
             //acl judge
             $oMbqWrEtForumPost = MbqMain::$oClk->newObj('MbqWrEtForumPost');
             $oMbqEtThank->userId->setOriValue(MbqMain::$oCurMbqEtUser->userId->oriValue);
             $oMbqWrEtForumPost->thankPost($oMbqEtForumPost, $oMbqEtThank);
             $this->data['result'] = true;
             $oTapatalkPush = new TapatalkPush();
             $oTapatalkPush->callMethod('doInternalPushThank', array('oMbqEtForumPost' => $oMbqEtForumPost, 'oMbqEtThank' => $oMbqEtThank));
         } else {
             MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Need valid post id!", '', MBQ_ERR_APP);
     }
 }
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (MbqMain::$oMbqConfig->moduleIsEnable('pc') && MbqMain::$oMbqConfig->getCfg('pc.conversation')->oriValue == MbqBaseFdt::getFdt('MbqFdtConfig.pc.conversation.range.support')) {
     } else {
         MbqError::alert('', "Not support module private conversation!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqEtPc = MbqMain::$oClk->newObj('MbqEtPc');
     $oMbqEtPc->userNames->setOriValue($in->usernames);
     $oMbqEtPc->convTitle->setOriValue($in->subject);
     $oMbqEtPc->convContent->setOriValue($in->body);
     if (isset($in->attachmentIds)) {
         $oMbqEtPc->attachmentIdArray->setOriValue($in->attachmentIds);
     }
     if (isset($in->groupId)) {
         $oMbqEtPc->groupId->setOriValue($in->groupId);
     }
     $oMbqAclEtPc = MbqMain::$oClk->newObj('MbqAclEtPc');
     $aclResult = $oMbqAclEtPc->canAclNewConversation($oMbqEtPc);
     if ($aclResult === true) {
         //acl judge
         $oMbqWrEtPc = MbqMain::$oClk->newObj('MbqWrEtPc');
         $oMbqEtPc = $oMbqWrEtPc->addMbqEtPc($oMbqEtPc);
         $this->data['result'] = true;
         $this->data['conv_id'] = (string) $oMbqEtPc->convId->oriValue;
         $oMbqRdEtPcMsg = MbqMain::$oClk->newObj('MbqRdEtPcMsg');
         $oMbqEtPcMsg = $oMbqRdEtPcMsg->initOMbqEtPcMsg($oMbqEtPc, array('case' => 'byPcMsgId', 'pcMsgId' => $oMbqEtPc->firstMsgId->oriValue));
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doInternalPushNewConversation', array('oMbqEtPc' => $oMbqEtPc, 'oMbqEtPcMsg' => $oMbqEtPcMsg));
     } else {
         MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
     }
 }
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (MbqMain::$oMbqConfig->moduleIsEnable('pm')) {
         $oMbqEtPm = MbqMain::$oClk->newObj('MbqEtPm');
         $oMbqEtPm->userNames->setOriValue($in->usernames);
         $oMbqEtPm->msgTitle->setOriValue($in->subject);
         $oMbqEtPm->msgContent->setOriValue($in->body);
         if ($in->action == 1) {
             $oMbqEtPm->isReply->setOriValue(true);
             $oMbqEtPm->toMsgId->setOriValue($in->messageId);
         } else {
             if ($in->action == 2) {
                 $oMbqEtPm->isForward->setOriValue(true);
                 $oMbqEtPm->toMsgId->setOriValue($in->messageId);
             }
         }
         $oMbqAclEtPm = MbqMain::$oClk->newObj('MbqAclEtPm');
         $aclResult = $oMbqAclEtPm->canAclCreateMessage();
         if ($aclResult === true) {
             $oMbqWrEtPm = MbqMain::$oClk->newObj('MbqWrEtPm');
             $oMbqWrEtPm->addMbqEtPm($oMbqEtPm);
             $this->data['result'] = true;
             $this->data['msg_id'] = (string) $oMbqEtPm->msgId->oriValue;
             $oTapatalkPush = new TapatalkPush();
             $oTapatalkPush->callMethod('doInternalPushNewMessage', array('oMbqEtPm' => $oMbqEtPm));
         } else {
             MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Not support module private message!", '', MBQ_ERR_NOT_SUPPORT);
     }
 }
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('forum')) {
         MbqError::alert('', "Not support module forum!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqEtForumPost = MbqMain::$oClk->newObj('MbqEtForumPost');
     $oMbqEtForumPost->forumId->setOriValue($in->forumId);
     $oMbqEtForumPost->topicId->setOriValue($in->topicId);
     $oMbqEtForumPost->postTitle->setOriValue($in->subject);
     $oMbqEtForumPost->postContent->setOriValue($in->body);
     if (isset($in->attachmentIds)) {
         $oMbqEtForumPost->attachmentIdArray->setOriValue($in->attachmentIds);
     }
     if (isset($in->groupId)) {
         $oMbqEtForumPost->groupId->setOriValue($in->groupId);
     }
     $returnHtml = $in->returnHtml;
     $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum');
     if ($oMbqEtForum = $oMbqRdEtForum->initOMbqEtForum($oMbqEtForumPost->forumId->oriValue, array('case' => 'byForumId'))) {
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         if ($oMbqEtForumTopic = $oMbqRdEtForumTopic->initOMbqEtForumTopic($oMbqEtForumPost->topicId->oriValue, array('case' => 'byTopicId'))) {
             if ($oMbqEtForumTopic->topicId->oriValue == $oMbqEtForumPost->topicId->oriValue && $oMbqEtForumTopic->forumId->oriValue == $oMbqEtForum->forumId->oriValue) {
                 $oMbqEtForumPost->oMbqEtForum = $oMbqEtForum;
                 $oMbqEtForumPost->oMbqEtForumTopic = $oMbqEtForumTopic;
                 $oMbqAclEtForumPost = MbqMain::$oClk->newObj('MbqAclEtForumPost');
                 $aclResult = $oMbqAclEtForumPost->canAclReplyPost($oMbqEtForumTopic);
                 if ($aclResult === true) {
                     //acl judge
                     $oMbqWrEtForumPost = MbqMain::$oClk->newObj('MbqWrEtForumPost');
                     $oMbqWrEtForumPost->addMbqEtForumPost($oMbqEtForumPost);
                     $oMbqRdEtForumPost = MbqMain::$oClk->newObj('MbqRdEtForumPost');
                     //reload post
                     if ($oMbqEtForumPost = $oMbqRdEtForumPost->initOMbqEtForumPost($oMbqEtForumPost->postId->oriValue, array('case' => 'byPostId'))) {
                         $this->data['result'] = true;
                         $data1 = $oMbqRdEtForumPost->returnApiDataForumPost($oMbqEtForumPost, $returnHtml);
                         MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
                         if ($oMbqEtForumPost->state->hasSetOriValue()) {
                             $this->data['state'] = $oMbqEtForumPost->state->oriValue;
                         }
                         $oTapatalkPush = new TapatalkPush();
                         $oTapatalkPush->callMethod('doInternalPushReply', array('oMbqEtForumPost' => $oMbqEtForumPost));
                     } else {
                         MbqError::alert('', "Can not load new post!", '', MBQ_ERR_APP);
                     }
                 } else {
                     MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
                 }
             } else {
                 MbqError::alert('', "Data error!", '', MBQ_ERR_APP);
             }
         } else {
             MbqError::alert('', "Need valid topic id!", '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Need valid forum id!", '', MBQ_ERR_APP);
     }
 }
예제 #7
0
 /**
  * action implement
  */
 protected function actionImplement()
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('forum')) {
         MbqError::alert('', "Not support module forum!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqEtForumPost = MbqMain::$oClk->newObj('MbqEtForumPost');
     $oMbqEtForumPost->forumId->setOriValue(MbqMain::$input[0]);
     $oMbqEtForumPost->topicId->setOriValue(MbqMain::$input[1]);
     $oMbqEtForumPost->postTitle->setOriValue(MbqMain::$input[2]);
     $oMbqEtForumPost->postContent->setOriValue(MbqMain::$input[3]);
     if (isset(MbqMain::$input[4])) {
         $oMbqEtForumPost->attachmentIdArray->setOriValue((array) MbqMain::$input[4]);
     }
     if (isset(MbqMain::$input[5])) {
         $oMbqEtForumPost->groupId->setOriValue(MbqMain::$input[5]);
     }
     $returnHtml = (bool) MbqMain::$input[6];
     $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum');
     $objsMbqEtForum = $oMbqRdEtForum->getObjsMbqEtForum(array($oMbqEtForumPost->forumId->oriValue), array('case' => 'byForumIds'));
     if ($objsMbqEtForum && ($oMbqEtForum = $objsMbqEtForum[0])) {
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         if ($oMbqEtForumTopic = $oMbqRdEtForumTopic->initOMbqEtForumTopic($oMbqEtForumPost->topicId->oriValue, array('case' => 'byTopicId'))) {
             if ($oMbqEtForumTopic->topicId->oriValue == $oMbqEtForumPost->topicId->oriValue && $oMbqEtForumTopic->forumId->oriValue == $oMbqEtForum->forumId->oriValue) {
                 $oMbqAclEtForumPost = MbqMain::$oClk->newObj('MbqAclEtForumPost');
                 if ($oMbqEtForumTopic->oFirstMbqEtForumPost && $oMbqAclEtForumPost->canAclReplyPost($oMbqEtForumTopic->oFirstMbqEtForumPost)) {
                     //acl judge
                     $oMbqEtForumPost->parentPostId->oriValue = $oMbqEtForumTopic->oFirstMbqEtForumPost->postId->oriValue;
                     $oMbqWrEtForumPost = MbqMain::$oClk->newObj('MbqWrEtForumPost');
                     $oMbqWrEtForumPost->addMbqEtForumPost($oMbqEtForumPost);
                     $state = $oMbqEtForumPost->state->oriValue;
                     $oMbqRdEtForumPost = MbqMain::$oClk->newObj('MbqRdEtForumPost');
                     //reload post
                     if ($oMbqEtForumPost = $oMbqRdEtForumPost->initOMbqEtForumPost($oMbqEtForumPost->postId->oriValue, array('case' => 'byPostId'))) {
                         $this->data['result'] = true;
                         $data1 = $oMbqRdEtForumPost->returnApiDataForumPost($oMbqEtForumPost, $returnHtml);
                         MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
                         $this->data['state'] = $state;
                         $oTapatalkPush = new TapatalkPush();
                         $oTapatalkPush->callMethod('doPushReply', array('oMbqEtForumPost' => $oMbqEtForumPost));
                     } else {
                         MbqError::alert('', "Can not load new post!", '', MBQ_ERR_APP);
                     }
                 } else {
                     MbqError::alert('', '', '', MBQ_ERR_APP);
                 }
             } else {
                 MbqError::alert('', "Data error!", '', MBQ_ERR_APP);
             }
         } else {
             MbqError::alert('', "Need valid topic id!", '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Need valid forum id!", '', MBQ_ERR_APP);
     }
 }
예제 #8
0
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('user')) {
         MbqError::alert('', "Not support module user!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqRdCommon = MbqMain::$oClk->newObj('MbqRdCommon');
     $check_spam = $oMbqRdCommon->getCheckSpam();
     $this->register = false;
     $this->TTVerify($in->token, $in->code);
     $result = false;
     if ($this->verified) {
         $this->setUserInfo($this->TTEmail);
         if (isset($this->oMbqEtUser)) {
             $result = $this->loginUser($in->trustCode);
         } else {
             $this->register = true;
             $this->createUser($this->TTEmail, $in->username, $in->password, $in->customRegisterFields, $check_spam);
             $result = $this->loginUser($in->trustCode);
         }
     } else {
         $this->setUserInfo($in->email);
         if ($in->email && $in->username && empty($this->oMbqEtUser)) {
             $this->register = true;
             $this->createUser($in->email, $in->username, $in->password, $in->customRegisterFields, $check_spam);
             $result = $this->loginUser($in->trustCode);
         } else {
             $this->errors[] = 'Tapatalk authorization verify failed, please login with your username and password.';
         }
     }
     if ($result === true) {
         $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
         $this->data['result'] = true;
         $this->data['register'] = $this->register;
         $data1 = $oMbqRdEtUser->returnApiDataUser(MbqMain::$oCurMbqEtUser);
         MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doAfterAppLogin', MbqMain::$oCurMbqEtUser->userId->oriValue);
     } else {
         $this->data['result'] = false;
         if ($result == 'two-step-required') {
             $this->data['two_step_required'] = true;
             $this->data['result_text'] = "This account require Two Step verification.";
         } else {
             $this->data['result_text'] = $result . PHP_EOL;
             foreach ($this->errors as $key => $value) {
                 $this->data['result_text'] .= $value . PHP_EOL;
             }
         }
     }
 }
 /**
  * @see \wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (!WBB_TAPATALK_ENABLE_PUSH_NOTIFICATION) {
         return;
     }
     $method = '';
     $pushData = array();
     $routeData = RouteHandler::getInstance()->getRouteData();
     $controller = $routeData['controller'];
     $parameters = $eventObj->getParameters();
     $returnValues = $eventObj->getReturnValues();
     $actionName = $eventObj->getActionName();
     if ($controller == 'ConversationAdd' && $actionName == 'create') {
         // new conversation
         if (!empty($parameters['conversation']) && $parameters['conversation']->conversationID && $parameters['conversation']->subject) {
             $method = 'doPushConversation';
             $pushData = array('convId' => $returnValues['returnValues']->conversationID, 'msgId' => $returnValues['returnValues']->messageID);
         }
     } else {
         if ($controller == 'ConversationMessageAdd' && $actionName == 'create') {
             // extended reply
             if (!empty($returnValues['returnValues']) && $returnValues['returnValues']->messageID && $returnValues['returnValues']->conversationID) {
                 $method = 'doPushConversation';
                 $pushData = array('convId' => $returnValues['returnValues']->conversationID, 'msgId' => $returnValues['returnValues']->messageID);
             }
         } else {
             if ($controller == 'AJAXProxy' && $actionName == 'quickReply') {
                 // quick reply
                 if (!empty($parameters['data']['conversationID']) && $parameters['data']['conversationID']) {
                     $latestMessageID = $this->getLatestMsgID($parameters['data']['conversationID']);
                     if ($latestMessageID) {
                         $method = 'doPushConversation';
                         $pushData = array('convId' => $parameters['data']['conversationID'], 'msgId' => $latestMessageID);
                     }
                 }
             }
         }
     }
     // push
     if (!empty($method) && !empty($pushData)) {
         if (file_exists(WBB_TAPATALK_DIR . '/push/TapatalkPush.php')) {
             require_once WBB_TAPATALK_DIR . '/push/TapatalkPush.php';
             $tapatalkPush = new \TapatalkPush();
             $tapatalkPush->callMethod($method, $pushData);
         }
     }
 }
예제 #10
0
 /**
  * action implement
  */
 protected function actionImplement()
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('user')) {
         MbqError::alert('', "Not support module user!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
     $result = $oMbqRdEtUser->login(MbqMain::$input[0], MbqMain::$input[1]);
     if ($result) {
         $this->data['result'] = true;
         $data1 = $oMbqRdEtUser->returnApiDataUser(MbqMain::$oCurMbqEtUser);
         MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doAfterAppLogin');
     } else {
         $this->data['result'] = false;
     }
 }
예제 #11
0
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('user')) {
         MbqError::alert('', "Not support module user!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $code = '';
     if (isset($_COOKIE['X-TT'])) {
         $code = trim($_COOKIE['X-TT']);
     } else {
         if (isset($_SERVER['HTTP_X_TT'])) {
             $code = trim($_SERVER['HTTP_X_TT']);
         }
     }
     include_once MBQ_3RD_LIB_PATH . 'classTTConnection.php';
     $connection = new classTTConnection();
     $response = $connection->actionVerification($code, 'login');
     if ($connection->success && $response !== true) {
         if ($response === false && empty($connection->errors)) {
             $this->data['result_text'] = "Unauthorized app detected.";
         } else {
             $this->data['result_text'] = "The site failed to connect to Tapatalk servers and some functions will not work properly. Please contact the forum admin to resolve this issue.";
         }
     }
     $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
     $result = $oMbqRdEtUser->login($in->login, $in->password, $in->anonymous, $in->trustCode);
     if ($result === true) {
         $this->data['result'] = true;
         $data1 = $oMbqRdEtUser->returnApiDataUser(MbqMain::$oCurMbqEtUser);
         MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doAfterAppLogin', MbqMain::$oCurMbqEtUser->userId->oriValue);
     } else {
         $this->data['result'] = false;
         if ($result == 'two-step-required') {
             $this->data['two_step_required'] = true;
         } else {
             $this->data['result_text'] = $result;
         }
         if (!$oMbqRdEtUser->initOMbqEtUser($in->login, array('case' => 'byLoginName'))) {
             $this->data['status'] = (string) 2;
             //!!! attention the (string)
         }
     }
 }
 /**
  * @see \wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (!WBB_TAPATALK_ENABLE_PUSH_NOTIFICATION) {
         return;
     }
     $threadID = $eventObj->threadID;
     // reply post in more options mode
     if ($threadID) {
         $thread = new Thread($threadID);
         // push
         if ($thread->threadID) {
             if (file_exists(WBB_TAPATALK_DIR . '/push/TapatalkPush.php')) {
                 require_once WBB_TAPATALK_DIR . '/push/TapatalkPush.php';
                 $tapatalkPush = new \TapatalkPush();
                 $tapatalkPush->callMethod('doPushReply', array('oThread' => $thread));
             }
         }
     }
 }
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('user')) {
         MbqError::alert('', "Not support module user!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
     $trustCode = "";
     $result = $oMbqRdEtUser->loginTwoStep($in->twoStepCode, $in->trust, $trustCode);
     if ($result === true) {
         $this->data['result'] = true;
         $data1 = $oMbqRdEtUser->returnApiDataUser(MbqMain::$oCurMbqEtUser);
         MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
         if (!empty($trustCode)) {
             $this->data['trust_code'] = $trustCode;
         }
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doAfterAppLogin', MbqMain::$oCurMbqEtUser->userId->oriValue);
     } else {
         $this->data['result'] = false;
         $this->data['result_text'] = $result;
     }
 }
예제 #14
0
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('forum')) {
         MbqError::alert('', "Not support module forum!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqEtForumTopic = MbqMain::$oClk->newObj('MbqEtForumTopic');
     $oMbqEtForumTopic->forumId->setOriValue($in->forumId);
     $oMbqEtForumTopic->topicTitle->setOriValue($in->subject);
     $oMbqEtForumTopic->topicContent->setOriValue($in->body);
     $oMbqEtForumTopic->prefixId->setOriValue($in->prefixId);
     if (isset($in->attachmentIds)) {
         $oMbqEtForumTopic->attachmentIdArray->setOriValue($in->attachmentIds);
     }
     if (isset($in->groupId)) {
         $oMbqEtForumTopic->groupId->setOriValue($in->groupId);
     }
     $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum');
     if ($oMbqEtForum = $oMbqRdEtForum->initOMbqEtForum($oMbqEtForumTopic->forumId->oriValue, array('case' => 'byForumId'))) {
         $oMbqAclEtForumTopic = MbqMain::$oClk->newObj('MbqAclEtForumTopic');
         $aclResult = $oMbqAclEtForumTopic->canAclNewTopic($oMbqEtForum);
         if ($aclResult === true) {
             //acl judge
             $oMbqEtForumTopic->oMbqEtForum = $oMbqEtForum;
             $oMbqWrEtForumTopic = MbqMain::$oClk->newObj('MbqWrEtForumTopic');
             $oMbqWrEtForumTopic->addMbqEtForumTopic($oMbqEtForumTopic);
             $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
             $this->data['result'] = true;
             $data1 = $oMbqRdEtForumTopic->returnApiDataForumTopic($oMbqEtForumTopic);
             MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
             $this->data['state'] = $oMbqEtForumTopic->state->oriValue;
             $oTapatalkPush = new TapatalkPush();
             $oTapatalkPush->callMethod('doInternalPushNewTopic', array('oMbqEtForumTopic' => $oMbqEtForumTopic));
         } else {
             MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Need valid forum id!", '', MBQ_ERR_APP);
     }
 }
예제 #15
0
 /**
  * action implement
  */
 protected function actionImplement()
 {
     if (!MbqMain::$oMbqConfig->moduleIsEnable('forum')) {
         MbqError::alert('', "Not support module forum!", '', MBQ_ERR_NOT_SUPPORT);
     }
     $oMbqEtForumTopic = MbqMain::$oClk->newObj('MbqEtForumTopic');
     $oMbqEtForumTopic->forumId->setOriValue(MbqMain::$input[0]);
     $oMbqEtForumTopic->topicTitle->setOriValue(MbqMain::$input[1]);
     $oMbqEtForumTopic->topicContent->setOriValue(MbqMain::$input[2]);
     $oMbqEtForumTopic->prefixId->setOriValue(MbqMain::$input[3]);
     if (isset(MbqMain::$input[4])) {
         $oMbqEtForumTopic->attachmentIdArray->setOriValue((array) MbqMain::$input[4]);
     }
     if (isset(MbqMain::$input[5])) {
         $oMbqEtForumTopic->groupId->setOriValue(MbqMain::$input[5]);
     }
     $oMbqRdEtForum = MbqMain::$oClk->newObj('MbqRdEtForum');
     $objsMbqEtForum = $oMbqRdEtForum->getObjsMbqEtForum(array($oMbqEtForumTopic->forumId->oriValue), array('case' => 'byForumIds'));
     if ($objsMbqEtForum && ($oMbqEtForum = $objsMbqEtForum[0])) {
         $oMbqAclEtForumTopic = MbqMain::$oClk->newObj('MbqAclEtForumTopic');
         if ($oMbqAclEtForumTopic->canAclNewTopic($oMbqEtForum)) {
             //acl judge
             $oMbqWrEtForumTopic = MbqMain::$oClk->newObj('MbqWrEtForumTopic');
             $oMbqWrEtForumTopic->addMbqEtForumTopic($oMbqEtForumTopic);
             $state = $oMbqEtForumTopic->state->oriValue;
             $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
             $this->data['result'] = true;
             $data1 = $oMbqRdEtForumTopic->returnApiDataForumTopic($oMbqEtForumTopic);
             MbqMain::$oMbqCm->mergeApiData($this->data, $data1);
             $this->data['state'] = $oMbqEtForumTopic->state->oriValue;
             $oTapatalkPush = new TapatalkPush();
             $oTapatalkPush->callMethod('doPushNewtopic', array('oMbqEtForumTopic' => $oMbqEtForumTopic));
         } else {
             MbqError::alert('', '', '', MBQ_ERR_APP);
         }
     } else {
         MbqError::alert('', "Need valid forum id!", '', MBQ_ERR_APP);
     }
 }
 /**
  * @see \wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (!WBB_TAPATALK_ENABLE_PUSH_NOTIFICATION) {
         return;
     }
     $method = '';
     $pushData = array();
     $routeData = RouteHandler::getInstance()->getRouteData();
     $controller = $routeData['controller'];
     $returnValues = $eventObj->getReturnValues();
     $actionName = $eventObj->getActionName();
     if ($actionName == 'triggerPublication' && !empty($returnValues['objectIDs'][0])) {
         if ($controller == 'AJAXProxy') {
             // quick reply post
             $post = new Post($returnValues['objectIDs'][0]);
             if ($post->postID) {
                 $method = 'doPushReply';
                 $pushData = array('oPost' => $post);
             }
         } else {
             if ($controller == 'ThreadAdd' && (!isset($_POST['type']) || $_POST['type'] != 2)) {
                 // new topic
                 $objects = $eventObj->getObjects();
                 $data = $objects[0];
                 $method = 'doPushNewTopic';
                 $pushData = array('postId' => $returnValues['objectIDs'][0], 'boardId' => $data->getThread()->boardID);
             }
         }
     }
     // push
     if (!empty($method) && !empty($pushData)) {
         if (file_exists(WBB_TAPATALK_DIR . '/push/TapatalkPush.php')) {
             require_once WBB_TAPATALK_DIR . '/push/TapatalkPush.php';
             $tapatalkPush = new \TapatalkPush();
             $tapatalkPush->callMethod($method, $pushData);
         }
     }
 }
예제 #17
0
 protected function actionImplement($in)
 {
     $oMbqRdEtForumPost = MbqMain::$oClk->newObj('MbqRdEtForumPost');
     $oMbqEtForumPost = $oMbqRdEtForumPost->initOMbqEtForumPost($in->postId, array('case' => 'byPostId'));
     if (empty($oMbqEtForumPost)) {
         MbqError::alert('', 'Need valid post id', '', MBQ_ERR_APP);
     }
     $oMbqAclEtForumPost = MbqMain::$oClk->newObj('MbqAclEtForumPost');
     $aclResult = $oMbqAclEtForumPost->canAclLikePost($oMbqEtForumPost);
     if ($aclResult === true) {
         if ($oMbqEtForumPost->isLiked->oriValue == 1) {
             $this->data['result'] = true;
             return;
         }
         $oMbqWrEtForumPost = MbqMain::$oClk->newObj('MbqWrEtForumPost');
         $oMbqWrEtForumPost->likePost($oMbqEtForumPost);
         $oTapatalkPush = new TapatalkPush();
         $oTapatalkPush->callMethod('doInternalPushLike', array('oMbqEtForumPost' => $oMbqEtForumPost));
         $this->data['result'] = true;
     } else {
         MbqError::alert('', $aclResult, '', MBQ_ERR_APP);
     }
 }
 /**
  * @see \wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     $method = '';
     $pushData = array();
     $action = $eventObj->getActionName();
     $parameters = $eventObj->getParameters();
     $returnValues = $eventObj->getReturnValues();
     if ($action == 'saveSubscription' && isset($returnValues['returnValues']['subscribe']) && $returnValues['returnValues']['subscribe'] == 1 && !empty($parameters['objectID'])) {
         // subscirbe topic
         if (isset($parameters['objectType']) && $parameters['objectType'] == 'com.woltlab.wbb.thread') {
             $method = 'doPushSubscribeTopic';
             $pushData = array('threadId' => $parameters['objectID']);
         }
     }
     // push
     if (!empty($method) && !empty($pushData)) {
         if (file_exists(WBB_TAPATALK_DIR . '/push/TapatalkPush.php')) {
             require_once WBB_TAPATALK_DIR . '/push/TapatalkPush.php';
             $tapatalkPush = new \TapatalkPush();
             $tapatalkPush->callMethod($method, $pushData);
         }
     }
 }
 /**
  * @see \wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (!WBB_TAPATALK_ENABLE_PUSH_NOTIFICATION) {
         return;
     }
     $method = '';
     $pushData = array();
     $action = $eventObj->getActionName();
     $parameters = $eventObj->getParameters();
     $returnValues = $eventObj->getReturnValues();
     if ($action == 'like' && isset($returnValues['returnValues']['isLiked']) && $returnValues['returnValues']['isLiked'] == 1 && !empty($parameters['data']['objectID'])) {
         // like post
         $method = 'doPushLikePost';
         $pushData = array('postId' => $parameters['data']['objectID']);
     }
     // push
     if (!empty($method) && !empty($pushData)) {
         if (file_exists(WBB_TAPATALK_DIR . '/push/TapatalkPush.php')) {
             require_once WBB_TAPATALK_DIR . '/push/TapatalkPush.php';
             $tapatalkPush = new \TapatalkPush();
             $tapatalkPush->callMethod($method, $pushData);
         }
     }
 }
 /**
  * action implement
  */
 protected function actionImplement($in)
 {
     $TapatalkPush = new \TapatalkPush();
     $result = $TapatalkPush->set_push_slug(0);
     $this->data = array('result' => $result);
 }