From c1cb2460dc9eca22c8faebbe70c6970fa4da324b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 13 Jan 2010 14:50:21 -0500 Subject: [PATCH] Condition moved to avoid fatal error --- main/exercice/exercise_result.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php index 8797cbda18..d5f0e5807b 100755 --- a/main/exercice/exercise_result.php +++ b/main/exercice/exercise_result.php @@ -122,20 +122,18 @@ $from_name = api_get_person_name($uinfo['firstname'], $uinfo['lastname'], null, $str = $_SERVER['REQUEST_URI']; $url = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq().'&show=result'; + // if the above variables are empty or incorrect, we don't have any result to show, so stop the script +if(!is_array($exerciseResult) || !is_array($questionList) || !is_object($objExercise)) { + header('Location: exercice.php'); + exit(); +} $sql_fb_type='SELECT feedback_type FROM '.$TBL_EXERCICES.' WHERE id ="'.Database::escape_string($objExercise->selectId()).'"'; - $res_fb_type=Database::query($sql_fb_type,__FILE__,__LINE__); $row_fb_type=Database::fetch_row($res_fb_type); $feedback_type = $row_fb_type[0]; - // if the above variables are empty or incorrect, we don't have any result to show, so stop the script -if(!is_array($exerciseResult) || !is_array($questionList) || !is_object($objExercise)) -{ - header('Location: exercice.php'); - exit(); -} // define basic exercise info to print on screen $exerciseTitle=$objExercise->selectTitle(); $exerciseDescription=$objExercise->selectDescription();