Merge branch 'MDL-37896' of git://github.com/timhunt/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2013-02-12 01:13:18 +01:00
commit 625d5f8164
3 changed files with 9 additions and 7 deletions

View file

@ -116,7 +116,11 @@ define('PARAM_BOOL', 'bool');
define('PARAM_CAPABILITY', 'capability'); define('PARAM_CAPABILITY', 'capability');
/** /**
* PARAM_CLEANHTML - cleans submitted HTML code. use only for text in HTML format. This cleaning may fix xhtml strictness too. * PARAM_CLEANHTML - cleans submitted HTML code. Note that you almost never want
* to use this. The normal mode of operation is to use PARAM_RAW when recieving
* the input (required/optional_param or formslib) and then sanitse the HTML
* using format_text on output. This is for the rare cases when you want to
* sanitise the HTML on input. This cleaning may also fix xhtml strictness.
*/ */
define('PARAM_CLEANHTML', 'cleanhtml'); define('PARAM_CLEANHTML', 'cleanhtml');

View file

@ -64,7 +64,7 @@ class question_attempt {
* @var string special value to indicate a response variable that is uploaded * @var string special value to indicate a response variable that is uploaded
* files. * files.
*/ */
const PARAM_CLEANHTML_FILES = 'paramcleanhtmlfiles'; const PARAM_RAW_FILES = 'paramrawfiles';
/** @var integer if this attempts is stored in the question_attempts table, the id of that row. */ /** @var integer if this attempts is stored in the question_attempts table, the id of that row. */
protected $id = null; protected $id = null;
@ -888,8 +888,8 @@ class question_attempt {
case self::PARAM_FILES: case self::PARAM_FILES:
return $this->process_response_files($name, $name, $postdata); return $this->process_response_files($name, $name, $postdata);
case self::PARAM_CLEANHTML_FILES: case self::PARAM_RAW_FILES:
$var = $this->get_submitted_var($name, PARAM_CLEANHTML, $postdata); $var = $this->get_submitted_var($name, PARAM_RAW, $postdata);
return $this->process_response_files($name, $name . ':itemid', $postdata, $var); return $this->process_response_files($name, $name . ':itemid', $postdata, $var);
default: default:

View file

@ -55,9 +55,7 @@ class qtype_essay_question extends question_with_responses {
public function get_expected_data() { public function get_expected_data() {
if ($this->responseformat == 'editorfilepicker') { if ($this->responseformat == 'editorfilepicker') {
$expecteddata = array('answer' => question_attempt::PARAM_CLEANHTML_FILES); $expecteddata = array('answer' => question_attempt::PARAM_RAW_FILES);
} else if ($this->responseformat == 'editor') {
$expecteddata = array('answer' => PARAM_CLEANHTML);
} else { } else {
$expecteddata = array('answer' => PARAM_RAW); $expecteddata = array('answer' => PARAM_RAW);
} }