Jelajahi Sumber

[svn r19000] Security improvement - Fckeditor reduced see FS#3805

Julio Montoya 16 tahun lalu
induk
melakukan
099e327c5b
2 mengubah file dengan 14 tambahan dan 12 penghapusan
  1. 8 6
      main/survey/create_new_survey.php
  2. 6 6
      main/survey/fillsurvey.php

+ 8 - 6
main/survey/create_new_survey.php

@@ -3,7 +3,7 @@
 ==============================================================================
 	Dokeos - elearning and course management software
 
-	Copyright (c) 2004-2008 Dokeos SPRL
+	Copyright (c) 2004-2009 Dokeos SPRL
 
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
@@ -25,7 +25,7 @@
 * 	@author unknown, the initial survey that did not make it in 1.8 because of bad code
 * 	@author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
 *	@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
-* 	@version $Id: create_new_survey.php 18287 2009-02-06 16:23:12Z ndieschburg $
+* 	@version $Id: create_new_survey.php 19000 2009-03-12 15:48:07Z juliomontoya $
 *
 * 	@todo only the available platform languages should be used => need an api get_languages and and api_get_available_languages (or a parameter)
 */
@@ -136,7 +136,7 @@ else
 }
 
 // initiate the object
-$form = new FormValidator('survey', 'post', api_get_self().'?action='.$_GET['action'].'&survey_id='.$_GET['survey_id']);
+$form = new FormValidator('survey', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']));
 
 // settting the form elements
 if ($_GET['action'] == 'edit' AND isset($_GET['survey_id']) AND is_numeric($_GET['survey_id']))
@@ -151,9 +151,11 @@ if ($_GET['action'] == 'edit') {
 } 
 
 $fck_attribute['Width'] = '100%';
-$fck_attribute['Height'] = '100';
+$fck_attribute['Height'] = '120';
 $fck_attribute['ToolbarSet'] = 'Survey';
 $form->addElement('html_editor', 'survey_title', get_lang('SurveyTitle'));
+$fck_attribute['Config']['ToolbarStartExpanded']='false';
+$fck_attribute['Height'] = '100';
 $form->addElement('html_editor', 'survey_subtitle', get_lang('SurveySubTitle'));
 $lang_array = api_get_languages();
 foreach ($lang_array['name'] as $key=>$value)
@@ -169,7 +171,7 @@ $form->addElement('datepickerdate', 'end_date', get_lang('EndDate'), array('form
 /** TODO maybe it is better to change this into false instead see line 95 in survey.lib.php */
 //$group[] =& HTML_QuickForm::createElement('radio', 'survey_share',null, get_lang('No'),0);
 
-$fck_attribute['Height'] = '200';
+$fck_attribute['Height'] = '150';
 //$form->addGroup($group, 'survey_share', get_lang('ShareSurvey'), '&nbsp;');
 $form->addElement('checkbox', 'anonymous', get_lang('Anonymous'));
 $form->addElement('html_editor', 'survey_introduction', get_lang('SurveyIntroduction'));
@@ -331,4 +333,4 @@ else
 
 // Footer
 Display :: display_footer();
-?>
+?>

+ 6 - 6
main/survey/fillsurvey.php

@@ -525,10 +525,8 @@ if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($u
 	if ($form->validate()) 
 	{
 		$user_data = $form->exportValues();
-		if (is_array($user_data))
-		{
-			if (count($user_data)>0)
-			{
+		if (is_array($user_data)) {
+			if (count($user_data)>0) {
 				$extras = array ();
 				// build SQL query
 				$sql = "UPDATE $table_user SET";
@@ -546,8 +544,10 @@ if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($u
 				$sql .= " WHERE user_id  = '" . $user_id . "'";
 				api_sql_query($sql, __FILE__, __LINE__);
 				//update the extra fields
-				foreach ($extras as $key => $value) {
-					$myres = UserManager :: update_extra_field_value($user_id, $key, $value);
+				if (is_array($extras)) {
+					foreach ($extras as $key => $value) {
+						$myres = UserManager :: update_extra_field_value($user_id, $key, $value);
+					}
 				}
 				echo '<div id="survey_content" class="survey_content">' . get_lang('InformationUpdated') . ' ' . get_lang('PleaseFillSurvey') . '</div>';
 			}