diff --git a/main/document/download.php b/main/document/download.php index 8cfe588620..81a82b4ac5 100755 --- a/main/document/download.php +++ b/main/document/download.php @@ -2,6 +2,8 @@ /* For licensing terms, see /license.txt */ +use ChamiloSession as Session; + /** * This file is responsible for passing requested documents to the browser. * Many functions updated and moved to lib/document.lib.php. @@ -49,6 +51,9 @@ if (substr($refer_script, 0, 15) === '/fillsurvey.php') { $course = isset($queryParts['course']) ? $queryParts['course'] : ''; $invitation = isset($queryParts['invitationcode']) ? $queryParts['invitationcode'] : ''; include '../survey/survey.download.inc.php'; + if ('auto' === $invitation && $queryParts['scode']) { + $invitation = Session::read('auto_invitation_code_'.$queryParts['scode']); + } $_course = check_download_survey($course, $invitation, $doc_url); $_course['path'] = $_course['directory']; } else { diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index e5c0c5630d..ded5d6b2c1 100755 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -145,6 +145,7 @@ if ('auto' === $invitationcode && isset($_GET['scode'])) { } // From here we use the new invitationcode auto-userid-surveycode string $_GET['invitationcode'] = $autoInvitationcode; + Session::write('auto_invitation_code_'.$surveyCode, $autoInvitationcode); $invitationcode = $autoInvitationcode; } } @@ -574,6 +575,8 @@ if ( // The first thing we do is delete the session Session::erase('paged_questions'); Session::erase('page_questions_sec'); + Session::erase('auto_invitation_code_'.$survey_data['code']); + $paged_questions_sec = []; if (!empty($survey_data['survey_introduction'])) { echo '
'.Security::remove_XSS($survey_data['survey_introduction']).'
'; @@ -629,12 +632,14 @@ if ($survey_data['form_fields'] && // We unset the sessions Session::erase('paged_questions'); Session::erase('page_questions_sec'); + Session::erase('auto_invitation_code_'.$survey_data['code']); $paged_questions_sec = []; } else { echo '
'.get_lang('UpdateInformation').'
'; // We unset the sessions Session::erase('paged_questions'); Session::erase('page_questions_sec'); + Session::erase('auto_invitation_code_'.$survey_data['code']); $paged_questions_sec = []; $form->display(); } @@ -667,6 +672,7 @@ if (isset($_POST['finish_survey'])) { Session::erase('paged_questions'); Session::erase('page_questions_sec'); + Session::erase('auto_invitation_code_'.$survey_data['code']); Display::display_footer(); exit(); }