Browse Source

Fix header because use of api_not_allowed.

jmontoyaa 8 years ago
parent
commit
1e9d8a2ec4
2 changed files with 11 additions and 14 deletions
  1. 10 11
      main/forum/editpost.php
  2. 1 3
      main/inc/lib/api.lib.php

+ 10 - 11
main/forum/editpost.php

@@ -125,13 +125,6 @@ $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
@@ -146,7 +139,7 @@ if (!api_is_allowed_to_edit(null, true) &&
     (($current_forum_category && $current_forum_category['visibility'] == 0) ||
         $current_forum['visibility'] == 0)
 ) {
-    api_not_allowed();
+    api_not_allowed(true);
 }
 
 if (!api_is_allowed_to_edit(null, true) &&
@@ -156,11 +149,11 @@ if (!api_is_allowed_to_edit(null, true) &&
         $current_thread['locked'] <> 0
     )
 ) {
-    api_not_allowed();
+    api_not_allowed(true);
 }
 
 if (!$_user['user_id'] && $current_forum['allow_anonymous'] == 0) {
-    api_not_allowed();
+    api_not_allowed(true);
 }
 
 $group_id = api_get_group_id();
@@ -169,7 +162,13 @@ 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'])
 ) {
-    api_not_allowed();
+    api_not_allowed(true);
+}
+
+if ($origin == 'learnpath') {
+    Display::display_reduced_header();
+} else {
+    Display::display_header();
 }
 
 // Action links

+ 1 - 3
main/inc/lib/api.lib.php

@@ -3187,16 +3187,14 @@ function api_not_allowed($print_headers = false, $message = null)
     global $this_section;
 
     if (CustomPages::enabled() && !isset($user_id)) {
-
         if (empty($user_id)) {
             // Why the CustomPages::enabled() need to be to set the request_uri
             $_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
         }
-
         CustomPages::display(CustomPages::INDEX_UNLOGGED);
     }
 
-    $origin = isset($_GET['origin']) ? $_GET['origin'] : '';
+    $origin = api_get_origin();
 
     $msg = null;
     if (isset($message)) {