Skip to content

Commit

Permalink
filename is the 5th parameter. Now it's cleaned and used
Browse files Browse the repository at this point in the history
by the send_file() function.
  • Loading branch information
stronk7 committed Dec 14, 2004
1 parent fa6ed70 commit be88433
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rss/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
// extract relative path components
$args = explode('/', trim($relativepath, '/'));

if (count($args) < 4) {
if (count($args) < 5) {
not_found();
}

$courseid = (int)$args[0];
$userid = (int)$args[1];
$modulename = clean_param($args[2], PARAM_FILE);
$instance = (int)$args[3];
$filename = clean_param($args[4], PARAM_FILE);

if (!$course = get_record("course", "id", $courseid)) {
not_found();
Expand Down Expand Up @@ -68,7 +69,6 @@
not_found();
}

$filename = $instance.'.xml';
$pathname = $CFG->dataroot.'/rss/'.$modulename.'/'.$filename;

//Check that file exists
Expand All @@ -81,7 +81,7 @@

function not_found() {
/// error, send some XML with error message
global $lifetime;
send_file(rss_geterrorxmlfile(), 'rsserror.xml', $lifetime, false, true);
global $lifetime, $filename;
send_file(rss_geterrorxmlfile(), $filename, $lifetime, false, true);
}
?>

0 comments on commit be88433

Please sign in to comment.