diff --git a/main/forum/editpost.php b/main/forum/editpost.php
index ec7baa2748..050eb61470 100644
--- a/main/forum/editpost.php
+++ b/main/forum/editpost.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;
diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php
index 3dc0287e14..7bac6e062d 100644
--- a/main/forum/forumfunction.inc.php
+++ b/main/forum/forumfunction.inc.php
@@ -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;
diff --git a/main/forum/forumqualify.php b/main/forum/forumqualify.php
old mode 100755
new mode 100644
index 0f6c607f8f..0ab4d9b695
--- a/main/forum/forumqualify.php
+++ b/main/forum/forumqualify.php
@@ -155,7 +155,7 @@ if ($message<>'PostDeletedSpecial') {// in this case the first and only post of
echo '';*/
// 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
diff --git a/main/forum/newthread.php b/main/forum/newthread.php
index cbad196ef8..f138c29c3b 100644
--- a/main/forum/newthread.php
+++ b/main/forum/newthread.php
@@ -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
diff --git a/main/forum/viewforumcategory.php b/main/forum/viewforumcategory.php
index d229ed57b2..c1fe21ffda 100644
--- a/main/forum/viewforumcategory.php
+++ b/main/forum/viewforumcategory.php
@@ -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 */
diff --git a/main/forum/viewpost.php b/main/forum/viewpost.php
old mode 100755
new mode 100644
index 895e10721c..e96fcc2c1d
--- a/main/forum/viewpost.php
+++ b/main/forum/viewpost.php
@@ -118,7 +118,7 @@ if ($message != 'PostDeletedSpecial') { // In this case the first and only post
echo '';
// 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
diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php
index b908db49de..d1e97e258f 100644
--- a/main/forum/viewthread.php
+++ b/main/forum/viewthread.php
@@ -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
diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php
index a33dc5cb25..691fadd04f 100644
--- a/main/forum/viewthread_flat.inc.php
+++ b/main/forum/viewthread_flat.inc.php
@@ -92,7 +92,7 @@ if (isset($current_thread['thread_id'])){
}
}
//echo '
';
- 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 ''.Display :: return_icon('message_reply_forum.png', get_lang('ReplyToMessage'))."";
@@ -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').'
';
}
if ($current_forum['locked']==1) {
diff --git a/main/forum/viewthread_nested.inc.php b/main/forum/viewthread_nested.inc.php
index 8b0d235015..d6c39052e8 100644
--- a/main/forum/viewthread_nested.inc.php
+++ b/main/forum/viewthread_nested.inc.php
@@ -91,7 +91,7 @@ foreach ($rows as $post) {
}
//echo '
';
//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 ''.Display :: return_icon('message_reply_forum.png', get_lang('ReplyToMessage'))."";
@@ -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').'
';
}
if ($current_forum['locked']==1) {
diff --git a/main/forum/viewthread_threaded.inc.php b/main/forum/viewthread_threaded.inc.php
index 91d4b66a54..b47d7e80ca 100644
--- a/main/forum/viewthread_threaded.inc.php
+++ b/main/forum/viewthread_threaded.inc.php
@@ -213,7 +213,7 @@ if (api_is_allowed_to_edit(null,true)) {
}
//echo '
';
//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 ''.Display :: return_icon('message_reply_forum.png', get_lang('ReplyToMessage'))."";
@@ -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').'
';
}
if ($current_forum['locked']==1) {