Example #1
0
 public function actionGuide()
 {
     $options = XenForo_Application::get('options');
     if (!XenForo_Visitor::getInstance()->hasPermission('games', 'labdefence') && !XenForo_Visitor::getInstance()->isSuperAdmin() || !$options->displayLabDefence && !XenForo_Visitor::getInstance()->isSuperAdmin() || !$options->displayLabDefenceGuide && !XenForo_Visitor::getInstance()->isSuperAdmin()) {
         return $this->responseNoPermission();
     }
     /* Set the ID of the post to be loaded */
     $postId = $options->labDefenceGuidePostId;
     /* Create a new ControllerHelper that will help us to get the post */
     $ftpHelper = new XenForo_ControllerHelper_ForumThreadPost($this);
     /* Use the ControllerHelper to see if the post we want to get is viewable by the user browsing */
     list($post, $thread) = $ftpHelper->assertPostValidAndViewable($postId);
     /* If the post has attachments */
     if ($post['attach_count'] > 0) {
         /* Let's get all the attachments of this post, if exists  */
         $attachmentModel = XenForo_Model::create('XenForo_Model_Attachment');
         $attachments = $attachmentModel->getAttachmentsByContentId('post', $postId);
         foreach ($attachments as $attachment) {
             /* Insert into the post data the attachments */
             $post['attachments'][$attachment['attachment_id']] = $attachmentModel->prepareAttachment($attachment);
         }
     }
     /* These parameters will be used in our template. We need to pass them into the response view. The $post param will be used too in the XenForo_ViewPublic instance */
     $viewParams = array('post' => $post);
     return $this->responseView('QCGames_ViewPublic_LabDefence_Guide', 'labdefence_guide', $viewParams);
 }
Example #2
0
 public function actionStaff()
 {
     $options = XenForo_Application::get('options');
     if (!XenForo_Visitor::getInstance()->hasPermission('players', 'view') || !$options->displayPlayers && !XenForo_Visitor::getInstance()->isSuperAdmin() || !$options->displayStaffList && !XenForo_Visitor::getInstance()->isSuperAdmin()) {
         return $this->responseNoPermission();
     }
     /* Set the ID of the post to be loaded */
     $postId = $options->applyStaffPostId;
     /* Create a new ControllerHelper that will help us to get the post */
     $ftpHelper = new XenForo_ControllerHelper_ForumThreadPost($this);
     /* Use the ControllerHelper to see if the post we want to get is viewable by the user browsing */
     list($post, $thread) = $ftpHelper->assertPostValidAndViewable($postId);
     /* If the post has attachments */
     if ($post['attach_count'] > 0) {
         /* Let's get all the attachments of this post, if exists  */
         $attachmentModel = XenForo_Model::create('XenForo_Model_Attachment');
         $attachments = $attachmentModel->getAttachmentsByContentId('post', $postId);
         foreach ($attachments as $attachment) {
             /* Insert into the post data the attachments */
             $post['attachments'][$attachment['attachment_id']] = $attachmentModel->prepareAttachment($attachment);
         }
     }
     $mod_raw = file_get_contents($options->restApiUrl . 'player.php?action=getMods&value=name');
     $ss_raw = file_get_contents($options->restApiUrl . 'player.php?action=getSS&value=name');
     $mods = array();
     $ss = array();
     while ($name = json_decode($mod_raw, true)) {
         array_push($mods, $name);
     }
     while ($name = json_decode($ss_raw, true)) {
         array_push($ss, $name);
     }
     $viewParams = array('mods' => $mods, 'ss' => $ss, 'post' => $post);
     return $this->responseView('QCPlayers_ViewPublic_Players_staff', 'player_staff_list', $viewParams);
 }
 /**
  *
  * @see XenForo_ControllerHelper_ForumThreadPost::getNodeBreadCrumbs()
  */
 public function getNodeBreadCrumbs(array $forum, $includeSelf = true)
 {
     if (ThemeHouse_SocialGroups_SocialForum::hasInstance()) {
         $socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance()->toArray();
         if (isset($socialForum['social_forum_id'])) {
             return $this->_controller->getModelFromCache('ThemeHouse_SocialGroups_Model_SocialForum')->getNodeBreadCrumbs($socialForum, $forum, $includeSelf);
         }
     }
     return parent::getNodeBreadCrumbs($forum, $includeSelf);
 }