MDL-23978 portfolio: do not cleanup images with portfolio URI scheme

The problem was in the order of the content preparing. Now when the
filters are always skipped (they have to) we must always run
format_text() first. That will prepare nice HTML in which we just
rewrite the portfolio URIs.
Note that we are still calling clean_text() so that we do not export
malicious code for portfolios like File download. In the future, this
may be changed, made format specific or even per-export configurable.
As a side product of the patch, I have re-enabled online assignment
portfolio export and switched $options->para to false consistently.
This commit is contained in:
David Mudrak
2010-11-15 22:59:06 +00:00
parent fca0c7b9af
commit b0f5d070e7
3 changed files with 8 additions and 10 deletions
@@ -272,7 +272,7 @@ class assignment_online extends assignment_base {
}
function portfolio_exportable() {
return false; // not until MDL-22001 is fixed :(
return true;
}
function portfolio_load_data($caller) {
@@ -296,7 +296,7 @@ class assignment_online extends assignment_base {
function portfolio_prepare_package($exporter, $user) {
$submission = $this->get_submission($user->id);
$options = new stdClass();
$options->para = true;
$options->para = false;
$options->filter = false;
$html = format_text($submission->data1, $submission->data2, $options);
$html = portfolio_rewrite_pluginfile_urls($html, $this->context->id, 'mod_assignment', $this->filearea, $submission->id, $exporter->get('format'));
+3 -3
View File
@@ -294,11 +294,11 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
$viewfullnames = true;
// format the post body
$options = new stdClass();
$options->para = true;
$options->para = false;
$options->filter = false;
$format = $this->get('exporter')->get('format');
$formattedtext = portfolio_rewrite_pluginfile_urls($post->message, $this->modcontext->id, 'mod_forum', 'post', $post->id, $format);
$formattedtext = format_text($formattedtext, $post->messageformat, $options, $this->get('course')->id);
$formattedtext = format_text($post->message, $post->messageformat, $options, $this->get('course')->id);
$formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->modcontext->id, 'mod_forum', 'post', $post->id, $format);
$output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">';
+3 -5
View File
@@ -386,14 +386,12 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
$output .= '<td class="entry">' . "\n";
$output .= '<div class="concept">';
$output .= format_text($OUTPUT->heading('<span class="nolink">' . $entry->concept . '</span>', 3, 'nolink'), FORMAT_MOODLE, $options);
$output .= format_text($OUTPUT->heading($entry->concept, 3), FORMAT_MOODLE, $options);
$output .= '</div> ' . "\n";
$entry->definition = format_text($entry->definition, $entry->definitionformat, $options);
$output .= portfolio_rewrite_pluginfile_urls($entry->definition, $context->id, 'mod_glossary', 'entry', $entry->id, $format);
$entry->definition = portfolio_rewrite_pluginfile_urls($entry->definition, $context->id, 'mod_glossary', 'entry', $entry->id, $format);
$options->overflowdiv = true;
$output .= format_text($entry->definition, $entry->definitionformat, $options);
if (isset($entry->footer)) {
$output .= $entry->footer;
}