Added missing permission check
authorMarcel Werk <burntime@woltlab.com>
Thu, 6 Jun 2013 15:46:54 +0000 (17:46 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 6 Jun 2013 15:46:54 +0000 (17:46 +0200)
wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentResponseUserActivityEvent.class.php
wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php

index f9efe4805b4fff1b3929e737d623d6ebdd147119..81cf038969082914bdec67d188b3bcbd31d2a9b7 100644 (file)
@@ -22,40 +22,43 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement
         * @see wcf\system\user\activity\event\IUserActivityEvent::prepare()
         */
        public function prepare(array $events) {
-               $responseIDs = array();
-               foreach ($events as $event) {
-                       $responseIDs[] = $event->objectID;
-               }
-               
-               // fetch responses
-               $responseList = new CommentResponseList();
-               $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array($responseIDs));
-               $responseList->readObjects();
-               $responses = $responseList->getObjects();
-               
-               // fetch comments
-               $commentIDs = $comments = array();
-               foreach ($responses as $response) {
-                       $commentIDs[] = $response->commentID;
-               }
-               if (!empty($commentIDs)) {
-                       $commentList = new CommentList();
-                       $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs));
-                       $commentList->readObjects();
-                       $comments = $commentList->getObjects();
-               }
+               $responses = $responseIDs = array();
                
-               // fetch users
-               $userIDs = $users = array();
-               foreach ($comments as $comment) {
-                       $userIDs[] = $comment->objectID;
-                       $userIDs[] = $comment->userID;
-               }
-               if (!empty($userIDs)) {
-                       $userList = new UserProfileList();
-                       $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
-                       $userList->readObjects();
-                       $users = $userList->getObjects();
+               if (WCF::getSession()->getPermission('user.profile.canViewUserProfile')) {
+                       foreach ($events as $event) {
+                               $responseIDs[] = $event->objectID;
+                       }
+                       
+                       // fetch responses
+                       $responseList = new CommentResponseList();
+                       $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array($responseIDs));
+                       $responseList->readObjects();
+                       $responses = $responseList->getObjects();
+                       
+                       // fetch comments
+                       $commentIDs = $comments = array();
+                       foreach ($responses as $response) {
+                               $commentIDs[] = $response->commentID;
+                       }
+                       if (!empty($commentIDs)) {
+                               $commentList = new CommentList();
+                               $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs));
+                               $commentList->readObjects();
+                               $comments = $commentList->getObjects();
+                       }
+                       
+                       // fetch users
+                       $userIDs = $users = array();
+                       foreach ($comments as $comment) {
+                               $userIDs[] = $comment->objectID;
+                               $userIDs[] = $comment->userID;
+                       }
+                       if (!empty($userIDs)) {
+                               $userList = new UserProfileList();
+                               $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
+                               $userList->readObjects();
+                               $users = $userList->getObjects();
+                       }
                }
                
                // set message
index fbbd94ed7fcdae91823889f9d1833fc8f924cd48..0ba8b1d51dc3cbb22dc98c0e21315c9252fc428d 100644 (file)
@@ -21,27 +21,30 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA
         * @see wcf\system\user\activity\event\IUserActivityEvent::prepare()
         */
        public function prepare(array $events) {
-               $comentIDs = array();
-               foreach ($events as $event) {
-                       $comentIDs[] = $event->objectID;
-               }
-               
-               // fetch comments
-               $commentList = new CommentList();
-               $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($comentIDs));
-               $commentList->readObjects();
-               $comments = $commentList->getObjects();
+               $comments = $comentIDs = array();
                
-               // fetch users
-               $userIDs = $users = array();
-               foreach ($comments as $comment) {
-                       $userIDs[] = $comment->objectID;
-               }
-               if (!empty($userIDs)) {
-                       $userList = new UserProfileList();
-                       $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
-                       $userList->readObjects();
-                       $users = $userList->getObjects();
+               if (WCF::getSession()->getPermission('user.profile.canViewUserProfile')) {
+                       foreach ($events as $event) {
+                               $comentIDs[] = $event->objectID;
+                       }
+                       
+                       // fetch comments
+                       $commentList = new CommentList();
+                       $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($comentIDs));
+                       $commentList->readObjects();
+                       $comments = $commentList->getObjects();
+                       
+                       // fetch users
+                       $userIDs = $users = array();
+                       foreach ($comments as $comment) {
+                               $userIDs[] = $comment->objectID;
+                       }
+                       if (!empty($userIDs)) {
+                               $userList = new UserProfileList();
+                               $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
+                               $userList->readObjects();
+                               $users = $userList->getObjects();
+                       }
                }
                
                // set message