Fixed time zone calculation issue
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / comment / manager / UserProfileCommentManager.class.php
1 <?php
2 namespace wcf\system\comment\manager;
3 use wcf\data\user\UserProfile;
4 use wcf\system\request\LinkHandler;
5 use wcf\system\WCF;
6
7 /**
8 * User profile comment manager implementation.
9 *
10 * @author Alexander Ebert
11 * @copyright 2001-2014 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package com.woltlab.wcf
14 * @subpackage system.comment.manager
15 * @category Community Framework
16 */
17 class UserProfileCommentManager extends AbstractCommentManager {
18 /**
19 * @see \wcf\system\comment\manager\AbstractCommentManager::$permissionAdd
20 */
21 protected $permissionAdd = 'user.profileComment.canAddComment';
22
23 /**
24 * @see \wcf\system\comment\manager\AbstractCommentManager::$permissionCanModerate
25 */
26 protected $permissionCanModerate = 'mod.profileComment.canModerateComment';
27
28 /**
29 * @see \wcf\system\comment\manager\AbstractCommentManager::$permissionDelete
30 */
31 protected $permissionDelete = 'user.profileComment.canDeleteComment';
32
33 /**
34 * @see \wcf\system\comment\manager\AbstractCommentManager::$permissionEdit
35 */
36 protected $permissionEdit = 'user.profileComment.canEditComment';
37
38 /**
39 * @see \wcf\system\comment\manager\AbstractCommentManager::$permissionModDelete
40 */
41 protected $permissionModDelete = 'mod.profileComment.canDeleteComment';
42
43 /**
44 * @see \wcf\system\comment\manager\AbstractCommentManager::$permissionModEdit
45 */
46 protected $permissionModEdit = 'mod.profileComment.canEditComment';
47
48 /**
49 * @see \wcf\system\comment\manager\ICommentManager::isAccessible()
50 */
51 public function isAccessible($objectID, $validateWritePermission = false) {
52 // check object id
53 $userProfile = UserProfile::getUserProfile($objectID);
54 if ($userProfile === null) {
55 return false;
56 }
57
58 // check visibility
59 if ($userProfile->isProtected()) {
60 return false;
61 }
62
63 // check target user settings
64 if ($validateWritePermission) {
65 if (!$userProfile->isAccessible('canWriteProfileComments') && $userProfile->userID != WCF::getUser()->userID) {
66 return false;
67 }
68
69 if ($userProfile->isIgnoredUser(WCF::getUser()->userID)) {
70 return false;
71 }
72 }
73
74 return true;
75 }
76
77 /**
78 * @see \wcf\system\comment\manager\ICommentManager::getLink()
79 */
80 public function getLink($objectTypeID, $objectID) {
81 return LinkHandler::getInstance()->getLink('User', array('id' => $objectID));
82 }
83
84 /**
85 * @see \wcf\system\comment\manager\ICommentManager::getTitle()
86 */
87 public function getTitle($objectTypeID, $objectID, $isResponse = false) {
88 if ($isResponse) return WCF::getLanguage()->get('wcf.user.profile.content.wall.commentResponse');
89
90 return WCF::getLanguage()->getDynamicVariable('wcf.user.profile.content.wall.comment');
91 }
92
93 /**
94 * @see \wcf\system\comment\manager\ICommentManager::updateCounter()
95 */
96 public function updateCounter($objectID, $value) { }
97 }