Updated the HEAD build version to 20090502
[moodle.git] / portfolio / file.php
CommitLineData
d96a1acc 1<?php
2require_once(dirname(dirname(__FILE__)) . '/config.php');
98335b2d 3
4if (empty($CFG->enableportfolios)) {
5 print_error('disabled', 'portfolio');
6}
7
d96a1acc 8require_once($CFG->libdir . '/portfoliolib.php');
9require_once($CFG->libdir . '/file/stored_file.php');
10require_once($CFG->libdir . '/filelib.php');
11
12$id = required_param('id', PARAM_INT);
13
98335b2d 14require_login();
15
d96a1acc 16$exporter = portfolio_exporter::rewaken_object($id);
6b6f1c05 17$exporter->verify_rewaken();
d96a1acc 18
19if ($exporter->get('instance')->is_push()) {
34035201 20 throw new portfolio_export_exception($exporter, 'filedenied', 'portfolio');
d96a1acc 21}
22
23if (!$exporter->get('instance')->verify_file_request_params(array_merge($_GET, $_POST))) {
34035201 24 throw new portfolio_export_exception($exporter, 'filedenied', 'portfolio');
d96a1acc 25}
26
2eb07e79 27$exporter->get('instance')->send_file();
d96a1acc 28$exporter->process_stage_cleanup(true);
2eb07e79 29exit;
d96a1acc 30?>