[ Index ]

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

title

Body

[close]

/user/ -> pix.php (source)

   1  <?PHP // $Id: pix.php,v 1.16.4.1 2007/10/11 11:12:52 nicolasconnault Exp $
   2        // This function fetches user pictures from the data directory
   3        // Syntax:   pix.php/userid/f1.jpg or pix.php/userid/f2.jpg
   4        //     OR:   ?file=userid/f1.jpg or ?file=userid/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('pix.php');
  15  
  16      $args = explode('/', trim($relativepath, '/'));
  17  
  18      if (count($args) == 2) {
  19          $userid   = (integer)$args[0];
  20          $image    = $args[1];
  21          $pathname = make_user_directory($userid, true) . "/$image";
  22          if (file_exists($pathname) and !is_dir($pathname)) {
  23              send_file($pathname, $image);
  24          }
  25      }
  26  
  27      // picture was deleted - use default instead
  28      redirect($CFG->pixpath.'/u/f1.png');
  29  ?>


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