[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/user/ -> pixgroup.php (source)

   1  <?php // $Id: pixgroup.php,v 1.7.8.1 2008/04/02 06:10:08 dongsheng Exp $
   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
   5  
   6      $nomoodlecookie = true;     // Because it interferes with caching
   7  
   8      require_once ('../config.php');
   9      require_once($CFG->libdir.'/filelib.php');
  10  
  11      // disable moodle specific debug messages
  12      disable_debugging();
  13  
  14      $relativepath = get_file_argument('pixgroup.php');
  15  
  16      $args = explode('/', trim($relativepath, '/'));
  17  
  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';
  25      }
  26  
  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??
  32      }
  33  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7