Bumped the version up to 1.9.3
[moodle.git] / user / pixgroup.php
blob6f72d38704f9fa80929bb569f6dc4a50e0ccd517
1 <?php // $Id$
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
12 disable_debugging();
14 $relativepath = get_file_argument('pixgroup.php');
16 $args = explode('/', trim($relativepath, '/'));
18 if (count($args) == 2) {
19 $groupid = (integer)$args[0];
20 $image = $args[1];
21 $pathname = $CFG->dataroot.'/groups/'.$groupid.'/'.$image;
22 } else {
23 $image = 'f1.png';
24 $pathname = $CFG->dirroot.'/pix/g/f1.png';
27 if (file_exists($pathname) and !is_dir($pathname)) {
28 send_file($pathname, $image);
29 } else {
30 header('HTTP/1.0 404 not found');
31 print_error('filenotfound', 'error'); //this is not displayed on IIS??