瀏覽代碼

Add error message if survey ID is not definde

Yannick Warnier 9 年之前
父節點
當前提交
2e94e4d58e
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      main/survey/survey.php

+ 6 - 1
main/survey/survey.php

@@ -53,7 +53,7 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
 $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', 'name' => get_lang('SurveyList'));
 
 // Getting the survey information
-if (isset($_GET['survey_id'])) {
+if (!empty($_GET['survey_id'])) {
 	$course_code = api_get_course_id();
 	if ($course_code!=-1) {
 		$survey_data = SurveyManager::get_survey($survey_id);
@@ -63,6 +63,11 @@ if (isset($_GET['survey_id'])) {
 		Display :: display_footer();
 		exit;
 	}
+} else {
+    Display :: display_header(get_lang('ToolSurvey'));
+    Display :: display_error_message(get_lang('NotAllowed'), false);
+    Display :: display_footer();
+    exit;
 }
 
 $tool_name = strip_tags($survey_data['title']);