diff --git a/main/forum/editpost.php b/main/forum/editpost.php index 48718a0004..ad72a332a6 100755 --- a/main/forum/editpost.php +++ b/main/forum/editpost.php @@ -125,11 +125,13 @@ $htmlHeadXtra[] = << JS; + if ($origin == 'learnpath') { Display::display_reduced_header(); } else { Display::display_header(); } + /* Is the user allowed here? */ // The user is not allowed here if @@ -144,10 +146,7 @@ if (!api_is_allowed_to_edit(null, true) && (($current_forum_category && $current_forum_category['visibility'] == 0) || $current_forum['visibility'] == 0) ) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } + api_not_allowed(); } if (!api_is_allowed_to_edit(null, true) && @@ -157,28 +156,20 @@ if (!api_is_allowed_to_edit(null, true) && $current_thread['locked'] <> 0 ) ) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } + api_not_allowed(); } if (!$_user['user_id'] && $current_forum['allow_anonymous'] == 0) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } + api_not_allowed(); } + $group_id = api_get_group_id(); if (!api_is_allowed_to_edit(null, true) && $current_forum['allow_edit'] == 0 && !GroupManager::is_tutor_of_group(api_get_user_id(), $group_properties['iid']) ) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } + api_not_allowed(); } // Action links diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index 74e335ce8b..2959f2ec03 100755 --- a/main/forum/forumfunction.inc.php +++ b/main/forum/forumfunction.inc.php @@ -3939,6 +3939,8 @@ function updateThreadInfo($thread_id, $last_post_id, $post_date) * This function is called when the user is not allowed in this forum/thread/... * @return bool display message of "not allowed" * + * @deprecated use api_not_allowed() + * * @author Patrick Cool , Ghent University * @version february 2006, dokeos 1.8 */ diff --git a/main/forum/iframe_thread.php b/main/forum/iframe_thread.php index 3e11a0d440..6d3874a07c 100755 --- a/main/forum/iframe_thread.php +++ b/main/forum/iframe_thread.php @@ -51,11 +51,8 @@ $current_forum_category = get_forumcategory_information( // 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['visibility'] == 0 OR $current_thread['visibility'] == 0)) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } +if (!api_is_allowed_to_edit(false, true) && ($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0)) { + api_not_allowed(false); } $course_id = api_get_course_int_id(); diff --git a/main/forum/viewpost.php b/main/forum/viewpost.php index c2a99c707b..97b82d46b1 100755 --- a/main/forum/viewpost.php +++ b/main/forum/viewpost.php @@ -85,10 +85,7 @@ if ($origin == 'learnpath') { if (!api_is_allowed_to_edit(false, true) && ($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0) ) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } + api_not_allowed(false); } /* Actions */ diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php index 656662f40f..594a220c9b 100755 --- a/main/forum/viewthread.php +++ b/main/forum/viewthread.php @@ -113,10 +113,7 @@ if ( !api_is_allowed_to_edit(false, true) && ($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0) ) { - $forum_allow = forum_not_allowed_here(); - if ($forum_allow === false) { - exit; - } + api_not_allowed(false); } /* Actions */ @@ -220,7 +217,6 @@ if ($my_message != 'PostDeletedSpecial') { echo ' '; /* Display Forum Category and the Forum information */ - if (!isset($_SESSION['view'])) { $viewMode = $current_forum['default_view']; } else { diff --git a/tests/main/forum/forumfunction.inc.test.php b/tests/main/forum/forumfunction.inc.test.php index a4a329a88a..d8e37ef6a0 100755 --- a/tests/main/forum/forumfunction.inc.test.php +++ b/tests/main/forum/forumfunction.inc.test.php @@ -487,7 +487,7 @@ class TestForumFunction extends UnitTestCase { } //var_dump($res); } - + /** * Retrieve all posts of a given thread * @param int $thread_id integer that indicates the forum @@ -1172,21 +1172,6 @@ class TestForumFunction extends UnitTestCase { $this->assertTrue(is_null($res)); //var_dump($res); } - - - /** - * This public function is called when the user is not allowed in this forum/thread/... - * @return bool display message of "not allowed" - */ - - public function testforum_not_allowed_here() { - ob_start(); - $res = forum_not_allowed_here(); - ob_end_clean(); - $this->assertTrue(is_bool($res)); - //var_dump($res); - } - /** * Delete the all the attachments from the DB and the file according to the post's id or attach id(optional) * @param post id