Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/user/grouppix.php
Go to the documentation of this file.
00001 <?php
00002       // This function fetches group pictures from the data directory
00003       // Syntax:   pix.php/groupid/f1.jpg or pix.php/groupid/f2.jpg
00004       //     OR:   ?file=groupid/f1.jpg or ?file=groupid/f2.jpg
00005 
00006 // disable moodle specific debug messages and any errors in output
00007 define('NO_DEBUG_DISPLAY', true);
00008 define('NO_MOODLE_COOKIES', true);                  // session not used here
00009 
00010     require_once('../config.php');
00011     require_once($CFG->libdir.'/filelib.php');
00012 
00013     $relativepath = get_file_argument();
00014 
00015     $args = explode('/', trim($relativepath, '/'));
00016 
00017     if (count($args) == 2) {
00018         $groupid  = (integer)$args[0];
00019         $image    = $args[1];
00020         $pathname = $CFG->dataroot.'/groups/'.$groupid.'/'.$image;
00021     } else {
00022         $image    = 'f1.png';
00023         $pathname = $CFG->dirroot.'/pix/g/f1.png';
00024     }
00025 
00026     if (file_exists($pathname) and !is_dir($pathname)) {
00027         send_file($pathname, $image);
00028     } else {
00029         header('HTTP/1.0 404 not found');
00030         print_error('filenotfound', 'error'); //this is not displayed on IIS??
00031     }
 All Data Structures Namespaces Files Functions Variables Enumerations