From 82df5fb74a002097dbfc1028f63c61bafe8d8a06 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 4 Jun 2014 14:44:40 +0200 Subject: [PATCH] Fixing redirection see BT#8207 and #6768 --- main/inc/local.inc.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 8727e58efc..195078b053 100755 --- a/main/inc/local.inc.php +++ b/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; } }