From: mjollnir_ Date: Wed, 22 Sep 2004 23:20:41 +0000 (+0000) Subject: Fixed handlevirus.php so that files resolve better to users. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=69a9b3d1bb222bc1555257a343d59e69ae636c89;p=moodle.git Fixed handlevirus.php so that files resolve better to users. 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 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 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: --- diff --git a/admin/handlevirus.php b/admin/handlevirus.php index d8aadfe33e..0b582b6aaa 100644 --- a/admin/handlevirus.php +++ b/admin/handlevirus.php @@ -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; }