예제 #1
0
 /**
  * Return if the specified user can view this comment
  *
  * @param TBGUser $user A User
  *
  * @return boolean
  */
 public function isViewableByUser(TBGUser $user)
 {
     $can_view = false;
     try {
         // Show comment if valid user and...
         if ($user instanceof TBGUser) {
             if (!$this->isPublic() && $user->canSeeNonPublicComments() || $this->isPublic() && $user->canViewComments() || $this->postedByUser($user->getID())) {
                 $can_view = true;
             }
             //endif
         }
         //endif
     } catch (Exception $e) {
     }
     return $can_view;
 }