Validating if $current_forum_category is not empty should resolve bug BT#3549 also when forums are locked

skala
Julio Montoya 13 years ago
parent 03615ff146
commit 893109eaf2
  1. 7
      main/forum/editpost.php
  2. 2
      main/forum/forumfunction.inc.php
  3. 2
      main/forum/forumqualify.php
  4. 4
      main/forum/newthread.php
  5. 7
      main/forum/viewforumcategory.php
  6. 2
      main/forum/viewpost.php
  7. 2
      main/forum/viewthread.php
  8. 4
      main/forum/viewthread_flat.inc.php
  9. 4
      main/forum/viewthread_nested.inc.php
  10. 4
      main/forum/viewthread_threaded.inc.php

@ -131,8 +131,7 @@ if (isset($_GET['origin'])) {
if ($origin == 'learnpath') {
include api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
} else {
Display :: display_header(null);
//api_display_tool_title($nameTools);
Display :: display_header(null);
}
/* Is the user allowed here? */
@ -145,14 +144,14 @@ if ($origin == 'learnpath') {
// The only exception is the course manager
// I have split this is several pieces for clarity.
//if (!api_is_allowed_to_edit() AND (($current_forum_category['visibility'] == 0 OR $current_forum['visibility'] == 0) OR ($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['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)) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;
}
}
if (!api_is_allowed_to_edit(null, true) AND ($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)) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;

@ -2967,7 +2967,7 @@ function send_notification_mails($thread_id, $reply_info) {
$current_thread = get_thread_information($thread_id);
$current_forum = get_forum_information($current_thread['forum_id']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
if ($current_thread['visibility'] == '1' && $current_forum['visibility'] == '1' && $current_forum_category['visibility'] == '1' && $current_forum['approval_direct_post'] != '1') {
if ($current_thread['visibility'] == '1' && $current_forum['visibility'] == '1' && ($current_forum_category && $current_forum_category['visibility'] == '1') && $current_forum['approval_direct_post'] != '1') {
$send_mails = true;
} else {
$send_mails = false;

@ -155,7 +155,7 @@ if ($message<>'PostDeletedSpecial') {// in this case the first and only post of
echo '</div>';*/
// the reply to thread link should only appear when the forum_category is not locked AND the forum is not locked AND the thread is not locked.
// if one of the three levels is locked then the link should not be displayed
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if (($current_forum_category && $current_forum_category['locked']==0) AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
// The link should only appear when the user is logged in or when anonymous posts are allowed.
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) {
//reply link

@ -101,11 +101,11 @@ if (!empty($_GET['gidReq'])) {
// 4. anonymous posts are not allowed and the user is not logged in
// I have split this is several pieces for clarity.
if (!api_is_allowed_to_edit(false, true) && (($current_forum_category['visibility'] == 0 || $current_forum['visibility'] == 0))) {
if (!api_is_allowed_to_edit(false, true) && (($current_forum_category['visibility'] && $current_forum_category['visibility'] == 0) || $current_forum['visibility'] == 0)) {
api_not_allowed();
}
// 2. the forumcategory or forum is locked (locked <>0) and the user is not a course manager
if (!api_is_allowed_to_edit(false, true) AND ($current_forum_category['locked'] <> 0 OR $current_forum['locked'] <> 0)) {
if (!api_is_allowed_to_edit(false, true) AND (($current_forum_category['visibility'] && $current_forum_category['locked'] <> 0) OR $current_forum['locked'] <> 0)) {
api_not_allowed();
}
// 3. new threads are not allowed and the user is not a course manager

@ -109,11 +109,8 @@ $whatsnew_post_info = $_SESSION['whatsnew_post_info'];
// if the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false,true) AND $current_forum_category['visibility']==0) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;
}
if (!api_is_allowed_to_edit(false,true) AND ($current_forum_category && $current_forum_category['visibility']==0)) {
api_not_allowed();
}
/* Action Links */

@ -118,7 +118,7 @@ if ($message != 'PostDeletedSpecial') { // In this case the first and only post
echo '</div>';
// The reply to thread link should only appear when the forum_category is not locked AND the forum is not locked AND the thread is not locked.
// If one of the three levels is locked then the link should not be displayed.
if ($current_forum_category['locked'] == 0 AND $current_forum['locked'] == 0 AND $current_thread['locked'] == 0 OR api_is_allowed_to_edit(false, true)) {
if (($current_forum_category && $current_forum_category['locked'] == 0) AND $current_forum['locked'] == 0 AND $current_thread['locked'] == 0 OR api_is_allowed_to_edit(false, true)) {
// The link should only appear when the user is logged in or when anonymous posts are allowed.
if ($_user['user_id'] OR ($current_forum['allow_anonymous'] == 1 AND !$_user['user_id'])) {
// reply link

@ -147,7 +147,7 @@ if ($my_message != 'PostDeletedSpecial') {
}
// The reply to thread link should only appear when the forum_category is not locked AND the forum is not locked AND the thread is not locked.
// If one of the three levels is locked then the link should not be displayed.
if ($current_forum_category['locked'] == 0 AND $current_forum['locked'] == 0 AND $current_thread['locked'] == 0 OR api_is_allowed_to_edit(false, true)) {
if (($current_forum_category && $current_forum_category['locked'] == 0) AND $current_forum['locked'] == 0 AND $current_thread['locked'] == 0 OR api_is_allowed_to_edit(false, true)) {
// The link should only appear when the user is logged in or when anonymous posts are allowed.
if ($_user['user_id'] OR ($current_forum['allow_anonymous'] == 1 AND !$_user['user_id'])) {
// reply link

@ -92,7 +92,7 @@ if (isset($current_thread['thread_id'])){
}
}
//echo '<br /><br />';
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if (($current_forum_category && $current_forum_category['locked']==0) AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) {
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false,true)) {
echo '<a href="reply.php?'.api_get_cidreq().'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;forum='.$clean_forum_id.'&amp;thread='.$clean_thread_id.'&amp;post='.$row['post_id'].'&amp;action=replymessage&amp;origin='.$origin.'">'.Display :: return_icon('message_reply_forum.png', get_lang('ReplyToMessage'))."</a>";
@ -100,7 +100,7 @@ if (isset($current_thread['thread_id'])){
}
}
} else {
if ($current_forum_category['locked']==1) {
if ($current_forum_category && $current_forum_category['locked']==1) {
echo get_lang('ForumcategoryLocked').'<br />';
}
if ($current_forum['locked']==1) {

@ -91,7 +91,7 @@ foreach ($rows as $post) {
}
//echo '<br /><br />';
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit())
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if (($current_forum_category && $current_forum_category['locked']==0) AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) {
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false,true)) {
echo '<a href="reply.php?'.api_get_cidreq().'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;forum='.$clean_forum_id.'&amp;thread='.$clean_thread_id.'&amp;post='.$post['post_id'].'&amp;action=replymessage&amp;origin='. $origin .'">'.Display :: return_icon('message_reply_forum.png', get_lang('ReplyToMessage'))."</a>";
@ -99,7 +99,7 @@ foreach ($rows as $post) {
}
}
} else {
if ($current_forum_category['locked']==1) {
if ($current_forum_category && $current_forum_category['locked']==1) {
echo get_lang('ForumcategoryLocked').'<br />';
}
if ($current_forum['locked']==1) {

@ -213,7 +213,7 @@ if (api_is_allowed_to_edit(null,true)) {
}
//echo '<br /><br />';
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit())
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if (($current_forum_category && $current_forum_category['locked']==0) AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) {
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) {
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false,true)) {
echo '<a href="reply.php?'.api_get_cidreq().'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;forum='.$clean_forum_id.'&amp;thread='.$clean_thread_id.'&amp;post='.$rows[$display_post_id]['post_id'].'&amp;action=replymessage&amp;origin='. $origin .'">'.Display :: return_icon('message_reply_forum.png', get_lang('ReplyToMessage'))."</a>";
@ -221,7 +221,7 @@ if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $cu
}
}
} else {
if ($current_forum_category['locked']==1) {
if ($current_forum_category && $current_forum_category['locked']==1) {
echo get_lang('ForumcategoryLocked').'<br />';
}
if ($current_forum['locked']==1) {

Loading…
Cancel
Save