Replace forum_not_allowed_here with api_not_allowed

pull/2487/head
jmontoyaa 9 years ago
parent 4ebb26c18b
commit d6b9ee43b5
  1. 23
      main/forum/editpost.php
  2. 2
      main/forum/forumfunction.inc.php
  3. 7
      main/forum/iframe_thread.php
  4. 5
      main/forum/viewpost.php
  5. 6
      main/forum/viewthread.php
  6. 17
      tests/main/forum/forumfunction.inc.test.php

@ -125,11 +125,13 @@ $htmlHeadXtra[] = <<<JS
</script>
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

@ -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 <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/

@ -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();

@ -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 */

@ -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 '</div>&nbsp;';
/* Display Forum Category and the Forum information */
if (!isset($_SESSION['view'])) {
$viewMode = $current_forum['default_view'];
} else {

@ -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

Loading…
Cancel
Save