if (!empty($_FILES) && !empty($_REQUEST['forum'])) {
// The user is not allowed here if
// 1. the forum category, forum or thread is invisible (visibility==0)
@ -35,15 +38,27 @@ if (!empty($action)) {
// 3. if anonymous posts are not allowed
// The only exception is the course manager
// They are several pieces for clarity.
if (!api_is_allowed_to_edit(null, true) AND (($current_forum_category && $current_forum_category['visibility'] == 0) OR $current_forum['visibility'] == 0)) {
if (!api_is_allowed_to_edit(null, true) AND
(
($current_forum_category && $current_forum_category['visibility'] == 0) OR
$current_forum['visibility'] == 0
)
) {
$json['errorMessage'] = '1. the forum category, forum or thread is invisible (visibility==0)';
break;
}
if (!api_is_allowed_to_edit(null, true) AND (($current_forum_category && $current_forum_category['locked'] <> 0 ) OR $current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0)) {
if (!api_is_allowed_to_edit(null, true) AND
(
($current_forum_category && $current_forum_category['locked'] <> 0) OR
$current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0
)
) {
$json['errorMessage'] = '2. the forum category, forum or thread is locked (locked <>0)';
break;
}
if (api_is_anonymous() AND $current_forum['allow_anonymous'] == 0) {
if (api_is_anonymous() AND
$current_forum['allow_anonymous'] == 0
) {
$json['errorMessage'] = '3. if anonymous posts are not allowed';
if (!api_is_allowed_to_edit(null, true) AND (($current_forum_category && $current_forum_category['visibility'] == 0) OR $current_forum['visibility'] == 0)) {
if (!api_is_allowed_to_edit(null, true) AND
(($current_forum_category && $current_forum_category['visibility'] == 0) OR $current_forum['visibility'] == 0)
) {
$json['errorMessage'] = '1. the forum category, forum or thread is invisible (visibility==0)';
break;
}
if (!api_is_allowed_to_edit(null, true) AND (($current_forum_category && $current_forum_category['locked'] <> 0 ) OR $current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0)) {
if (!api_is_allowed_to_edit(null, true) AND
(($current_forum_category && $current_forum_category['locked'] <> 0) OR $current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0)
) {
$json['errorMessage'] = '2. the forum category, forum or thread is locked (locked <>0)';
break;
}
@ -98,7 +126,10 @@ if (!empty($action)) {
break;
}
$group_id = api_get_group_id();
if (!api_is_allowed_to_edit(null, true) AND $current_forum['allow_edit'] == 0 && !GroupManager::is_tutor_of_group(api_get_user_id(), $group_id)) {