]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed handlevirus.php so that files resolve better to users.
authormjollnir_ <mjollnir_>
Wed, 22 Sep 2004 23:20:41 +0000 (23:20 +0000)
committermjollnir_ <mjollnir_>
Wed, 22 Sep 2004 23:20:41 +0000 (23:20 +0000)
These patches are maintained in an publicly accessible Arch repository, see: http://lists.eduforge.org/cgi-bin/archzoom.cgi/arch-eduforge@catalyst.net.nz--2004-MIRROR/moodle--eduforge--1.3.3

Index of arch patches in this commit:

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-93
    2004-09-22 22:46:10 GMT
    Penny Leach <penny@catalyst.net.nz>
    fix for resolving filenames in handlevirus

Full logs:

Revision: moodle--eduforge--1.3.3--patch-93
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Thu Sep 23 10:46:10 NZST 2004
Standard-date: 2004-09-22 22:46:10 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-93
Summary: fix for resolving filenames in handlevirus
Keywords:

admin/handlevirus.php

index d8aadfe33ea20bb4afac5773194b515ad146c766..0b582b6aaa5b5292f01b07583c4d08bd18ca6f73 100644 (file)
@@ -92,9 +92,12 @@ function validate_line($line) {
     }
     $index = strpos($line,":");
     $file = substr($line,0,$index);
-    $file = preg_replace('/\/\//','/',$file);
-    if (!file_exists($file)) {
-        // try and prepend dataroot, that might fix it (maybe) 
+    if (!(strpos($file,$CFG->dataroot) === false)) {
+        if (!file_exists($file)) {
+            return false;
+        }
+    }
+    else {
         if ($file{0} == "/") {
             $file = $CFG->dataroot.$file;
         }
@@ -105,6 +108,9 @@ function validate_line($line) {
             return false;
         }
     }
+    // clean up
+    $file = preg_replace('/\.\//','/',$file);
+    $file = preg_replace('/\/\//','/',$file);
     return $file;
 }