Пример #1
0
 /**
  * Checks that a forum is valid and viewable, before returning the forum's info.
  *
  * @param integer|string $forumIdOrName ID or node name of forum
  * @param array $fetchOptions Extra data to fetch wtih the forum
  *
  * @return array Forum info
  */
 public function assertForumValidAndViewable($forumIdOrName, array $fetchOptions = array())
 {
     $fetchOptions += array('permissionCombinationId' => $this->_visitor['permission_combination_id']);
     $forum = $this->getForumOrError($forumIdOrName, $fetchOptions);
     if (isset($forum['node_permission_cache'])) {
         $this->_visitor->setNodePermissions($forum['node_id'], $forum['node_permission_cache']);
         unset($forum['node_permission_cache']);
     }
     if (!$this->_controller->getModelFromCache('XenForo_Model_Forum')->canViewForum($forum, $errorPhraseKey)) {
         throw $this->_controller->getErrorOrNoPermissionResponseException($errorPhraseKey);
     }
     if ($forum['effective_style_id']) {
         $this->_controller->setViewStateChange('styleId', $forum['effective_style_id']);
     }
     return $forum;
 }