From 313a4631d54df76791d86cae378733fd295e7ba3 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sun, 8 Mar 2009 23:52:35 +0100 Subject: [PATCH] [svn r18840] Security improvements --- main/exercice/exercise_show.php | 103 ++++++++++++-------------------- 1 file changed, 38 insertions(+), 65 deletions(-) diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 79f77faca2..7c17aac276 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -1,31 +1,10 @@ - "../user/user.php?cidReq=".$_GET['course'], "name" => get_lang("Users")); - $interbreadcrumb[] = array("url" => "../mySpace/myStudents.php?student=".$_GET['student']."&course=".$_course['id']."&details=true&origin=".$_GET['origin'] , "name" => get_lang("DetailsStudentInCourse")); + $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".Security::remove_XSS($_GET['course']), "name" => get_lang("Users")); + $interbreadcrumb[] = array("url" => "../mySpace/myStudents.php?student=".Security::remove_XSS($_GET['student'])."&course=".$_course['id']."&details=true&origin=".Security::remove_XSS($_GET['origin']) , "name" => get_lang("DetailsStudentInCourse")); } else if($origin=='tracking_course') { $interbreadcrumb[] = array ("url" => "../mySpace/index.php", "name" => get_lang('MySpace')); - $interbreadcrumb[] = array ("url" => "../mySpace/myStudents.php?student=".$_GET['student'].'&details=true&origin='.$origin.'&course='.$_GET['cidReq'], "name" => get_lang("DetailsStudentInCourse")); + $interbreadcrumb[] = array ("url" => "../mySpace/myStudents.php?student=".Security::remove_XSS($_GET['student']).'&details=true&origin='.$origin.'&course='.Security::remove_XSS($_GET['cidReq']), "name" => get_lang("DetailsStudentInCourse")); } else if($origin=='student_progress') { - $interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".$_GET['id_session']."&course=".$_cid, "name" => get_lang('MyProgress')); + $interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".Security::remove_XSS($_GET['id_session'])."&course=".$_cid, "name" => get_lang('MyProgress')); unset($_cid); } else { @@ -135,7 +114,7 @@ else { if ($origin != 'learnpath') { Display::display_header($nameTools,"Exercise"); } -$emailId = $_REQUEST['email']; +$emailId = $_REQUEST['email']; $user_name = $_REQUEST['user']; $test = $_REQUEST['test']; $dt = $_REQUEST['dt']; @@ -198,27 +177,28 @@ function getFCK(vals,marksid){ * @return str the comment */ function get_comments($id,$question_id) - { +{ global $TBL_TRACK_ATTEMPT; //$sql = "select teacher_comment from ".$TBL_TRACK_ATTEMPT." where exe_id='".Database::escape_string($id and question_id)."' = '".Database::escape_string($question_id)."' order by question_id"; $sql = "select teacher_comment from ".$TBL_TRACK_ATTEMPT." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' order by question_id"; $sqlres = api_sql_query($sql, __FILE__, __LINE__); $comm = Database::result($sqlres,0,"teacher_comment"); return $comm; - } +} /** - * Enter description here... + * Display the answers to a multiple choice question * - * @param unknown_type $answerType - * @param unknown_type $studentChoice - * @param unknown_type $answer - * @param unknown_type $answerComment - * @param unknown_type $answerCorrect - * @param unknown_type $id - * @param unknown_type $questionId - * @param unknown_type $ans + * @param integer Answer type + * @param integer Student choice + * @param string Textual answer + * @param string Comment on answer + * @param string Correct answer comment + * @param integer Exercise ID + * @param integer Question ID + * @param boolean Whether to show the answer comment or not + * @return void */ -function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$ans) +function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) { ?> @@ -235,10 +215,11 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answer=api_parse_tex($answer); echo $answer; ?>
- + @@ -274,26 +253,21 @@ function display_fill_in_blanks_answer($answer,$id,$questionId) * @param int Question ID * @return void */ -function display_free_answer($answer,$id,$questionId) -{ +function display_free_answer($answer,$id,$questionId) { ?> - + + + + + - - - -