]> git.mjollnir.org Git - moodle.git/commitdiff
fix for MDL-6599 - problem with hiding of resource when $CFG->preventaccesstohiddenfi...
authorskodak <skodak>
Mon, 25 Sep 2006 08:53:10 +0000 (08:53 +0000)
committerskodak <skodak>
Mon, 25 Sep 2006 08:53:10 +0000 (08:53 +0000)
file.php

index 92232ebf7b85271c41a585e4b3c3ea17f1243ca9..dd9b161a7f9e30595de93562069df228c63d7e59 100644 (file)
--- a/file.php
+++ b/file.php
     // warning: it may break backwards compatibility
     if ((!empty($CFG->preventaccesstohiddenfiles)) 
         and (count($args) >= 2)
+        and (!(strtolower($args[1]) == 'moddata' and strtolower($args[2]) != 'resource')) // do not block files from other modules!
         and (!has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE, $course->id)))) {
 
-        $reference = ltrim($relativepath, "/{$args[0]}/");
+        $rargs = $args;
+        array_shift($rargs);
+        $reference = implode('/', $rargs);
 
         $sql = "SELECT COUNT(r.id) " .
                  "FROM {$CFG->prefix}resource r, " .