From c80b75857da196163828a401e16bb674aa4ebbf2 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Fri, 17 Sep 2004 00:10:53 +0000 Subject: [PATCH] Changes to log view page so that infected files comes under 'site errors'. 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-73 2004-09-17 00:05:28 GMT Penny Leach better logging for uploads and infected files, as well as changing the log page view slightly so that site errors yields infected files as well Full logs: Revision: moodle--eduforge--1.3.3--patch-73 Archive: arch-eduforge@catalyst.net.nz--2004 Creator: Penny Leach Date: Fri Sep 17 12:05:28 NZST 2004 Standard-date: 2004-09-17 00:05:28 GMT Modified-files: course/lib.php lib/uploadlib.php lib/weblib.php New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-73 Summary: better logging for uploads and infected files, as well as changing the log page view slightly so that site errors yields infected files as well Keywords: --- course/lib.php | 14 ++++++++------ lib/uploadlib.php | 4 ++-- lib/weblib.php | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/course/lib.php b/course/lib.php index 173c856804..523189e32e 100644 --- a/course/lib.php +++ b/course/lib.php @@ -320,16 +320,15 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today" $selectedactivity = "$mod->cm"; } } + } - if (isadmin() && !$course->category) { - $activities["site_errors"] = get_string("siteerrors"); - if ($modid === "site_errors") { + if (isadmin() && !$course->category) { + $activities["site_errors"] = get_string("siteerrors"); + if ($modid === "site_errors") { $selectedactivity = "site_errors"; - } } } - $strftimedate = get_string("strftimedate"); $strftimedaydate = get_string("strftimedaydate"); @@ -398,6 +397,9 @@ function make_log_url($module, $url) { case "admin": return "/$module/$url"; break; + case "upload": + return "$url"; + break; case "library": case "": return "/"; @@ -448,7 +450,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per } if ('site_errors' === $modid) { - $joins[] = "l.action='error'"; + $joins[] = "l.action='error' OR l.action='infected'"; } else if ($modid) { $joins[] = "l.cmid = '$modid'"; } diff --git a/lib/uploadlib.php b/lib/uploadlib.php index f08fc807fa..6463abd9b2 100644 --- a/lib/uploadlib.php +++ b/lib/uploadlib.php @@ -607,7 +607,7 @@ function clam_log_upload($newfilepath,$course=null) { if ($course) { $courseid = $course->id; } - add_to_log($courseid,"upload","upload","",$newfilepath); + add_to_log($courseid,"upload","upload",$_SERVER['HTTP_REFERER'],$newfilepath); } /** @@ -618,7 +618,7 @@ function clam_log_upload($newfilepath,$course=null) { */ function clam_log_infected($oldfilepath='',$newfilepath='',$userid=0) { - add_to_log(0,"upload","infected","",$oldfilepath,0,$userid); + add_to_log(0,"upload","infected",$_SERVER['HTTP_REFERER'],$oldfilepath,0,$userid); $user = get_record('user','id',$userid); diff --git a/lib/weblib.php b/lib/weblib.php index ab07ea10b7..09aa1470e4 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -336,6 +336,10 @@ function link_to_popup_window ($url, $name="popup", $linkname="click here", } $fullscreen = 0; + if (!(strpos($url,$CFG->wwwroot) === false)) { // some log url entries contain _SERVER[HTTP_REFERRER] in which case wwwroot is already there. + $url = substr($url,strlen($CFG->wwwroot)+1); + } + $link = "wwwroot$url\" ". "onclick=\"return openpopup('$url', '$name', '$options', $fullscreen);\">$linkname\n"; if ($return) { -- 2.39.5