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 $nomoodlecookie = true; // Because it interferes with caching
8 require_once('../config.php');
9 require_once($CFG->libdir
.'/filelib.php');
11 // disable moodle specific debug messages
14 $relativepath = get_file_argument('pixgroup.php');
16 $args = explode('/', trim($relativepath, '/'));
18 if (count($args) == 2) {
19 $groupid = (integer)$args[0];
21 $pathname = $CFG->dataroot
.'/groups/'.$groupid.'/'.$image;
24 $pathname = $CFG->dirroot
.'/pix/g/f1.png';
27 if (file_exists($pathname) and !is_dir($pathname)) {
28 send_file($pathname, $image);
30 header('HTTP/1.0 404 not found');
31 print_error('filenotfound', 'error'); //this is not displayed on IIS??