Browse Source

Fixing redirection see BT#8207 and #6768

Julio Montoya 10 years ago
parent
commit
82df5fb74a
1 changed files with 11 additions and 8 deletions
  1. 11 8
      main/inc/local.inc.php

+ 11 - 8
main/inc/local.inc.php

@@ -1239,22 +1239,25 @@ if (isset($_cid)) {
     Database::query($sql);
 }
 
-
 // direct login to course
-if ((isset($cas_login) && $cas_login && exist_firstpage_parameter())
-    || ($logging_in && exist_firstpage_parameter())) {
+if ((isset($cas_login) && $cas_login && exist_firstpage_parameter()) ||
+    ($logging_in && exist_firstpage_parameter())
+) {
     $redirectCourseDir = api_get_firstpage_parameter();
     api_delete_firstpage_parameter();    // delete the cookie
-    if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
-        $_SESSION['noredirection'] = false;
-        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir;
+
+    if (!isset($_SESSION['request_uri'])) {
+        if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
+            $_SESSION['noredirection'] = false;
+            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir;
+        }
     }
 } elseif (api_user_is_login() && exist_firstpage_parameter()) {
     $redirectCourseDir = api_get_firstpage_parameter();
-    api_delete_firstpage_parameter();    // delete the cookie
+    api_delete_firstpage_parameter(); // delete the cookie
     if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
         $_SESSION['noredirection'] = false;
-        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir;
+        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir;
     }
 }