本文整理匯總了PHP中IPSMember::canModerateContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::canModerateContent方法的具體用法?PHP IPSMember::canModerateContent怎麽用?PHP IPSMember::canModerateContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::canModerateContent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: canHardDeleteTopics
/**
* Determine if this user / forum combo can hard delete
*
* @param integer Forum ID
* @param array Topic information
* @return integer Boolean
*/
public function canHardDeleteTopics($fid = 0, $topic)
{
if ($fid and $this->_memberData['is_mod'] and !empty($this->_memberData['forumsModeratorData'][$fid]['delete_topic'])) {
return TRUE;
} elseif ($topic['starter_id'] == $this->_memberData['member_id'] and $this->_memberData['g_delete_own_topics']) {
return TRUE;
} else {
return IPSMember::canModerateContent($this->_memberData, IPSMember::CONTENT_DELETE, $topic['starter_id']);
}
}
示例2: can
/**
* Perform a permission check
*
* @param string Type of check (add/edit/delete/editall/deleteall/approve all)
* @param array Array of GENERIC data
* @return true or string to be used in exception
*/
public function can($type, array $array)
{
/* Init */
$comment = array();
/* Got data? */
if (empty($array['comment_parent_id'])) {
trigger_error("No parent ID passed to " . __FILE__, E_USER_WARNING);
}
/* Get the file */
$event = $this->fetchParent($array['comment_parent_id']);
/* Fetch comment */
if ($array['comment_id']) {
$comment = $this->fetchById($array['comment_id']);
}
/* Check permissions */
switch ($type) {
case 'view':
if (!$this->registry->permissions->check('view', $event)) {
return 'NO_PERMISSION';
}
if ($event['event_private'] and (!$this->memberData['member_id'] or $this->memberData['member_id'] != $event['event_member_id'])) {
return 'NO_PERMISSION';
}
if ($event['event_perms'] != '*') {
$permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
return 'NO_PERMISSION';
}
}
return true;
break;
case 'edit':
if (!$this->registry->permissions->check('comment', $event)) {
return 'NO_PERMISSION';
}
if (!$this->memberData['g_is_supmod'] and ($this->memberData['member_id'] != $comment['comment_author_id'] or !$comment['comment_author_id'])) {
return 'NO_PERMISSION';
}
return true;
break;
case 'add':
if (!$this->registry->permissions->check('comment', $event)) {
return 'NO_PERMISSION';
}
return true;
break;
case 'delete':
return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
break;
case 'visibility':
case 'moderate':
return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
break;
case 'hide':
return IPSMember::canModerateContent($this->memberData, IPSMember::CONTENT_HIDE, $comment['comment_author_id']) ? TRUE : 'NO_PERMISSION';
break;
case 'unhide':
return IPSMember::canModerateContent($this->memberData, IPSMember::CONTENT_UNHIDE, $comment['comment_author_id']) ? TRUE : 'NO_PERMISSION';
break;
}
}