Index: lib/moodlelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/moodlelib.php,v
retrieving revision 1.960.2.131
diff -u -r1.960.2.131 moodlelib.php
--- lib/moodlelib.php	7 May 2009 10:47:57 -0000	1.960.2.131
+++ lib/moodlelib.php	14 May 2009 21:09:41 -0000
@@ -8077,7 +8077,7 @@
 
     global $CFG;
 
-    if (strstr($dir, $CFG->dataroot.'/') === false) {
+    if (strstr(cleardoubleslashes($dir), cleardoubleslashes($CFG->dataroot.'/')) === false) {
         debugging('Warning. Wrong call to check_dir_exists(). $dir must be an absolute path under $CFG->dataroot ("' . $dir . '" is incorrect)', DEBUG_DEVELOPER);
     }
 
@@ -8091,7 +8091,7 @@
             if ($recursive) {
             /// We are going to make it recursive under $CFG->dataroot only
             /// (will help sites running open_basedir security and others)
-                $dir = str_replace($CFG->dataroot . '/', '', $dir);
+                $dir = str_replace(cleardoubleslashes($CFG->dataroot . '/'), '', cleardoubleslashes($dir));
             /// PHP 5.0 has recursive mkdir parameter, but 4.x does not :-(
                 $dir = str_replace('\\', '/', $dir); //windows compatibility
                 $dirs = explode('/', $dir); /// Extract path parts
