Beispiel #1
0
 public function prepareTeam(array $team, array $category = null, array $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     if ($category) {
         $team['canWarn'] = $this->canWarnTeam($team, $category, $null, $viewingUser);
         $team['canReport'] = $this->getModelFromCache('XenForo_Model_User')->canReportContent();
         $team['canDelete'] = $this->canDeleteTeam($team, $category, $null, $viewingUser);
         $team['canEdit'] = $this->canEditTeam($team, $category, $null, $viewingUser);
         $team['canUndelete'] = $this->canUndeleteTeam($team, $category, $null, $viewingUser);
         $team['getURLPortion'] = $this->canCustomizeUrlPortions($team, $category, $null, $viewingUser);
         $team['canApprove'] = $this->canApproveTeam($team, $category, $null, $viewingUser);
         $team['canUnapprove'] = $this->canUnapproveTeam($team, $category, $null, $viewingUser);
         $team['canFeatureUnfeature'] = $this->canFeatureUnfeatureTeam($team, $category, $null, $viewingUser);
         $team['canUploadAvatar'] = $this->canUploadAvatar($team, $category, $null, $viewingUser);
         $team['canReassign'] = $this->canReassignTeam($team, $category, $null, $viewingUser);
         if (!isset($team['canInlineMod'])) {
             $this->addInlineModOptionToTeam($team, $category, $viewingUser);
         }
         // update 1.0.9 BETA 1
         if (!$this->canViewTeamClosedAndContainer($team, $category, $null, $viewingUser)) {
             $team['message_count'] = 0;
             $team['last_activity'] = 0;
         } else {
             if (!$this->canViewTeamSecret($team, $category, $null, $viewingUser)) {
                 $team['message_count'] = 0;
                 $team['member_count'] = 0;
                 $team['last_activity'] = 0;
             }
         }
         $team['canUploadCover'] = $this->getModelFromCache('Nobita_Teams_Model_Cover')->canUploadCover($team, $category, $null, $viewingUser);
         $team['canChooseRibbon'] = $this->canChooseRibbon($team, $category, $null, $viewingUser);
         /* 1.1.3 */
         $team['canAddEvent'] = $this->getModelFromCache('Nobita_Teams_Model_Event')->canAddEvent($team, $category, $null, $viewingUser);
         /* 1.2.0 RC2 */
         $team['canManageTabs'] = $this->canManageTabs($team, $category, $null, $viewingUser);
         $team['coverCropDetails'] = @unserialize($team['cover_crop_details']);
         $team['isVisible'] = $this->isVisible($team);
         $team['isModerated'] = $this->isModerated($team);
         $team['isDeleted'] = $this->isDeleted($team);
         $team['viewBannedUsers'] = $this->getModelFromCache('Nobita_Teams_Model_Banning')->canViewBannedUsers($team, $category, $null, $viewingUser);
         if (array_key_exists('member_username', $team) && !empty($team['member_username'])) {
             // found
             $team['memberInfo'] = array('user_id' => $team['member_user_id'], 'username' => $team['member_username'], 'member_state' => $team['member_member_state'], 'position' => $team['member_position']);
             Nobita_Teams_Setup::helperMemberId($team['memberInfo'], $team['team_id'], $team['member_user_id']);
         } else {
             $team['memberInfo'] = array();
         }
         $fields = array('member_user_id', 'member_username', 'member_member_state', 'member_position');
         Nobita_Teams_Array::removeKeys($team, $fields);
         $team['canJoinTeam'] = $this->_getMemberModel()->canAsktoJoin($team, $category, $null, $viewingUser);
         $team['canMassAlert'] = $this->canSendMassAlerts($team, $category, $null, $viewingUser);
     } else {
         $team['canWarn'] = false;
         $team['canReport'] = false;
         $team['canDelete'] = false;
         $team['canEdit'] = false;
         $team['canUndelete'] = false;
         $team['getURLPortion'] = false;
         $team['canApprove'] = false;
         $team['canUnapprove'] = false;
         $team['canFeatureUnfeature'] = false;
         $team['canUploadAvatar'] = false;
         $team['canReassign'] = false;
         $team['canInlineMod'] = false;
         $team['canUploadCover'] = false;
         $team['canChooseRibbon'] = false;
         $team['canAddEvent'] = false;
         $team['canManageTabs'] = false;
         $team['coverCropDetails'] = false;
         $team['memberInfo'] = array();
     }
     $team['title'] = XenForo_Helper_String::censorString($team['title']);
     $team['titleCensored'] = true;
     if (array_key_exists('disable_tabs', $team)) {
         $team['disabledTabs'] = array_map('trim', explode(',', $team['disable_tabs']));
     }
     if (array_key_exists('user_avatar_date', $team)) {
         $team['user'] = array('user_id' => $team['user_id'], 'username' => $team['username'], 'gender' => $team['gender'], 'avatar_date' => $team['user_avatar_date'], 'gravatar' => $team['gravatar']);
     }
     return $team;
 }
Beispiel #2
0
 public function prepareComment(array $comment, array $postOrEvent, array $team, array $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     $comment['canDelete'] = $this->canDeleteComment($comment, $postOrEvent, $team, $null, $viewingUser);
     $comment['canEdit'] = $this->canEditComment($comment, $postOrEvent, $team, $null, $viewingUser);
     $comment['canLike'] = $this->canLikeComment($comment, $team, $team, $null, $viewingUser);
     $comment['likeUsers'] = unserialize($comment['like_users']);
     $removeFields = array();
     if (array_key_exists('commenter_user_id', $comment)) {
         $comment['comment_user'] = array('user_id' => $comment['commenter_user_id'], 'username' => $comment['commenter_username'], 'avatar_date' => $comment['commenter_avatar_date'], 'gender' => $comment['commenter_gender'], 'gravatar' => $comment['commenter_gravatar']);
         $removeFields = array_merge($removeFields, array('commenter_user_id', 'commenter_username', 'commenter_avatar_date', 'commenter_gender', 'commenter_gravatar'));
     }
     $comment = $this->getModelFromCache('Nobita_Teams_Model_Banning')->prepareContent($comment, $team, $team, $null, $viewingUser);
     Nobita_Teams_Array::removeKeys($comment, $removeFields);
     Nobita_Teams_Banning::generateBanningUniqueId($comment, 'comment');
     return $comment;
 }