Permalink
Browse files

MDL-25895, prevent repository_ajax.php being downloaded by IE when ph…

…p file is associated with other programs
  • Loading branch information...
1 parent 8cdc85a commit a7db0a260ee3d1c51e14d288e98879875193039b @dcai dcai committed Jan 17, 2011
Showing with 6 additions and 7 deletions.
  1. +6 −7 repository/repository_ajax.php
@@ -52,20 +52,19 @@
$search_text = optional_param('s', '', PARAM_CLEANHTML);
$linkexternal = optional_param('linkexternal', '', PARAM_ALPHA);
-@header('Content-type: text/plain; charset=utf-8');
+list($context, $course, $cm) = get_context_info_array($contextid);
+require_login($course, false, $cm);
+$PAGE->set_context($context);
+
+echo $OUTPUT->header(); // send headers
+@header('Content-type: text/html; charset=utf-8');
// if uploaded file is larger than post_max_size (php.ini) setting, $_POST content will lost
if (empty($_POST) && !empty($action)) {
$err->error = get_string('errorpostmaxsize', 'repository');
die(json_encode($err));
}
-list($context, $course, $cm) = get_context_info_array($contextid);
-require_login($course, false, $cm);
-$PAGE->set_context($context);
-
-echo $OUTPUT->header(); // send headers
-
if (!confirm_sesskey()) {
$err->error = get_string('invalidsesskey');
die(json_encode($err));

0 comments on commit a7db0a2

Please sign in to comment.