From: martin Date: Fri, 9 Aug 2002 09:09:36 +0000 (+0000) Subject: Changes to make uploaded user pictures work properly on Windows :-( X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2447921f18f5a0dd8d52f5ea5893d2d5fcde7162;p=moodle.git Changes to make uploaded user pictures work properly on Windows :-( --- diff --git a/admin/user.php b/admin/user.php index ab894c47ff..1b68d99959 100644 --- a/admin/user.php +++ b/admin/user.php @@ -100,6 +100,8 @@ "id&course=$site->id\">$stredit"); } print_table($table); + + print_heading("".get_string("addnewuser").""); } else { error("No users found!"); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index b2ccff6a8c..5d872d5341 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -124,7 +124,11 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns $size = 35; } if ($picture) { - $output .= "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 .= "wwwroot/user/pix.php?file=/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">"; + } else { // Use this method if possible for better caching + $output .= "wwwroot/user/pix.php/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">"; + } } else { $output .= "wwwroot/user/default/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">"; } @@ -1576,6 +1580,14 @@ function get_list_of_modules() { return $mods; } +function iswindows() { +// True if this is Windows, False if not. + + global $WINDIR; + + return empty($WINDIR); +} + ?> diff --git a/user/pix.php b/user/pix.php index 7c56d64473..b44fb0e643 100644 --- a/user/pix.php +++ b/user/pix.php @@ -1,13 +1,17 @@ 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");