コード例 #1
0
ファイル: Team.php プロジェクト: Sywooch/forums
 public function assertTeamValidAndViewable($teamIdOrName = null, array $teamFetchOptions = array(), array $categoryFetchOptions = array())
 {
     if (!isset($teamFetchOptions['join'])) {
         $teamFetchOptions['join'] = 0;
     }
     $teamFetchOptions['join'] |= Nobita_Teams_Model_Team::FETCH_PRIVACY | Nobita_Teams_Model_Team::FETCH_PROFILE | Nobita_Teams_Model_Team::FETCH_FEATURED;
     if ($this->_visitor->hasPermission('Teams', 'viewDeleted')) {
         $teamFetchOptions['join'] |= Nobita_Teams_Model_Team::FETCH_DELETION_LOG;
     }
     $visitor = XenForo_Visitor::getInstance();
     $teamFetchOptions['banUserId'] = $visitor['user_id'];
     $teamFetchOptions['memberUserId'] = $visitor['user_id'];
     $team = $this->getTeamOrError($teamIdOrName, $teamFetchOptions);
     $category = $this->assertCategoryValidAndViewable($team['team_category_id'], $categoryFetchOptions);
     $teamModel = $this->_controller->getModelFromCache('Nobita_Teams_Model_Team');
     if (!$teamModel->canViewTeam($team, $category, $errorPhraseKey)) {
         throw $this->_controller->getErrorOrNoPermissionResponseException($errorPhraseKey);
     }
     $team = $teamModel->prepareTeam($team, $category);
     $team = $teamModel->prepareTeamCustomFields($team, $category);
     if (!empty($team['ban_expired_date']) && $team['ban_expired_date'] > XenForo_Application::$time) {
         $banLift = new XenForo_Phrase('ban_will_be_automatically_lifted_on_x', array('date' => XenForo_Locale::date($team['ban_expired_date'])), false);
         throw $this->_controller->responseException($this->_controller->responseError($team['user_reason'] . '. ' . $banLift->render()));
     }
     return array($team, $category);
 }
コード例 #2
0
ファイル: Listener.php プロジェクト: Sywooch/forums
 public static function visitor_setup(XenForo_Visitor &$visitor)
 {
     $options = $visitor->get('bdsocialshare_options');
     if (!empty($options)) {
         $visitor['_bdSocialShare_options'] = bdSocialShare_Helper_Common::unserializeOrFalse($options);
     } else {
         $visitor['_bdSocialShare_options'] = array();
     }
     $visitor['_bdSocialShare_canStaffShare'] = $visitor->hasPermission('general', 'bdSocialShare_staffShare');
 }