"<A HREF=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</A>");
}
print_table($table);
+
+ print_heading("<A HREF=\"user.php?newuser=true\">".get_string("addnewuser")."</A>");
} else {
error("No users found!");
$size = 35;
}
if ($picture) {
- $output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
+ if (iswindows()) { // Workaround for a PATH_INFO problem on Windows PHP
+ $output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php?file=/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
+ } else { // Use this method if possible for better caching
+ $output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
+ }
} else {
$output .= "<IMG SRC=\"$CFG->wwwroot/user/default/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
}
return $mods;
}
+function iswindows() {
+// True if this is Windows, False if not.
+
+ global $WINDIR;
+
+ return empty($WINDIR);
+}
+
?>
<?PHP // $Id$
// This function fetches user pictures from the data directory
- // Syntax: file.php/userid/f1.jpg
+ // Syntax: pix.php/userid/f1.jpg or pix.php/userid/f2.jpg
+ // OR: ?file=userid/f1.jpg or ?file=userid/f2.jpg
require("../config.php");
$lifetime = 86400;
- if (!$PATH_INFO) {
- error("This script DEPENDS on $PATH_INFO being available. Read the README.");
+ if (isset($file)) {
+ $PATH_INFO = $file;
+
+ } else if (!$PATH_INFO) {
+ $PATH_INFO = ""; // Will just show default picture
}
$args = get_slash_arguments();
if ($numargs == 2) {
$userid = (integer)$args[0];
$image = $args[1];
+ $pathname = "$CFG->dataroot/users/$userid/$image";
} else {
- $userid = 0;
- $image = "f1.jpg";
+ $pathname = "$CFG->dirroot/user/default/f1.jpg";
}
- $pathname = "$CFG->dataroot/users/$userid/$image";
$lastmodified = filemtime($pathname);
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");