2 // This function fetches group pictures from the data directory
3 // Syntax: pix.php/groupid/f1.jpg or pix.php/groupid/f2.jpg
4 // OR: ?file=groupid/f1.jpg or ?file=groupid/f2.jpg
6 // disable moodle specific debug messages and any errors in output
7 define('NO_DEBUG_DISPLAY', true);
8 define('NO_MOODLE_COOKIES', true); // session not used here
10 require_once('../config.php');
11 require_once($CFG->libdir
.'/filelib.php');
13 $relativepath = get_file_argument();
15 $args = explode('/', trim($relativepath, '/'));
17 if (count($args) == 2) {
18 $groupid = (integer)$args[0];
20 $pathname = $CFG->dataroot
.'/groups/'.$groupid.'/'.$image;
23 $pathname = $CFG->dirroot
.'/pix/g/f1.png';
26 if (file_exists($pathname) and !is_dir($pathname)) {
27 send_file($pathname, $image);
29 header('HTTP/1.0 404 not found');
30 print_error('filenotfound', 'error'); //this is not displayed on IIS??