コード例 #1
0
ファイル: Misc.php プロジェクト: Sywooch/forums
 public function actionSetPushToken()
 {
     $token = $this->_input->filterSingle('token', XenForo_Input::STRING);
     $visitor = XenForo_Visitor::getInstance();
     if (!$visitor->getUserId()) {
         fr_no_permission();
     }
     fr_update_push_user('', 1, $token);
     return array('success' => true);
 }
コード例 #2
0
ファイル: Thread.php プロジェクト: Sywooch/forums
 public function actionVotePoll()
 {
     $threadid = $this->_input->filterSingle('threadid', XenForo_Input::UINT);
     $options = $this->_input->filterSingle('options', XenForo_Input::STRING);
     $visitor = XenForo_Visitor::getInstance();
     $helper = $this->getHelper('ForumThreadPost');
     $thread_model = $this->_getThreadModel();
     try {
         list($thread_info, $forum_info) = $helper->assertThreadValidAndViewable($threadid);
     } catch (Exception $e) {
         json_error($e->getControllerResponse()->errorText->render());
     }
     $poll_model = $this->_getPollModel();
     $poll = $poll_model->getPollByContent('thread', $threadid);
     if (!$poll) {
         fr_no_permission();
     }
     if (!$poll_model->canVoteOnPoll($poll, $error)) {
         $phrase = new XenForo_Phrase($error);
         json_error($phrase->render());
     }
     $options = preg_split('/,/', $options);
     if (!count($options)) {
         $phrase = new XenForo_Phrase(please_vote_for_at_least_one_option);
         json_error($phrase->render());
     }
     $poll_model->voteOnPoll($poll['poll_id'], $options);
     return array('success' => true);
 }