function redirect_to($sso, $user_id, $logged_in) { if (isset($sso['target']) && !empty($sso['target'])) { header('Location: ' . $sso['target']); } else { //Use this handy function to deal with platform settings Redirect::session_request_uri($logged_in, $user_id); } exit; }
/** * Checks whether the given URL contains "http". If not, prepend the web * root of Chamilo and send the browser there (HTTP redirect) * @param string $url */ public static function go($url = '') { if (empty($url)) { Redirect::session_request_uri(); $www = self::www(); self::navigate($www); } $is_full_uri = strpos($url, 'http') === 0; if ($is_full_uri) { self::navigate($url); } $url = self::www() . $url; self::navigate($url); }
$_SESSION['studentview'] = 'teacherview'; } } if (isset($_cid)) { $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $time = api_get_utc_datetime(); $sql = "UPDATE {$tbl_course} SET last_visit = '{$time}' WHERE code='{$_cid}'"; Database::query($sql); } // direct login to course 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 (!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 if (CourseManager::get_course_id_from_path($redirectCourseDir)) { $_SESSION['noredirection'] = false; $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; } } Redirect::session_request_uri($logging_in, $user_id);