Better Logging
This commit is contained in:
+21
-1
@@ -78,6 +78,7 @@
|
||||
# Check for dangerous events (hacking) !
|
||||
if(in_array($action,array("removepages","strippages","revertpages"))) {
|
||||
if(!($wiki->wtype=="student" || isteacher($course->id))) {
|
||||
add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to trick admin.php with $action.");
|
||||
error("Hack attack detected !");
|
||||
}
|
||||
}
|
||||
@@ -131,7 +132,26 @@
|
||||
if ($form = data_submitted()) {
|
||||
check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
/// Moodle Log
|
||||
add_to_log($course->id, "wiki", $action, "admin.php?id=$id");
|
||||
/// Get additional info
|
||||
$addloginfo="";
|
||||
switch($action) {
|
||||
case "removepages":
|
||||
$addloginfo=@join(", ", $form->pagestodelete);
|
||||
break;
|
||||
case "strippages":
|
||||
$addloginfo=@join(", ", $form->pagestostrip);
|
||||
break;
|
||||
case "checklinks":
|
||||
$addloginfo=$form->pagetocheck;
|
||||
break;
|
||||
case "setpageflags":
|
||||
// No additional info
|
||||
break;
|
||||
case "revertpages":
|
||||
// No additional info
|
||||
break;
|
||||
}
|
||||
add_to_log($course->id, "wiki", $action, "admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id", $wiki->name.($addloginfo?" ".$addloginfo:""));
|
||||
$link="admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id&wikipage=$wikipage";
|
||||
switch($action) {
|
||||
case "removepages":
|
||||
|
||||
@@ -74,15 +74,27 @@
|
||||
}
|
||||
$i2 = $i;
|
||||
while ($rm = $diff0[$i2++]) {
|
||||
$o .= "<b>-</b><font color=\"#990000\"><tt>$rm</tt></font><br>\n";
|
||||
if($wiki->htmlmode == 2) {
|
||||
$o .= "<br><b>-</b><font color=\"#990000\">$rm</font><br>\n";
|
||||
} else {
|
||||
$o .= "<b>-</b><font color=\"#990000\"><tt>$rm</tt></font><br>\n";
|
||||
}
|
||||
unset($diff0[$i2-1]);
|
||||
}
|
||||
|
||||
if (in_array($line, $diff2)) {
|
||||
$o .= "<b>+</b><font color=\"#009900\"> <tt>$line</tt></font><br>\n";
|
||||
if($wiki->htmlmode == 2) {
|
||||
$o .= "<br><b>+</b><font color=\"#009900\">$line</font>\n";
|
||||
} else {
|
||||
$o .= "<b>+</b><font color=\"#009900\"><tt>$line</tt></font><br>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$o .= " $line<br>\n";
|
||||
if($wiki->htmlmode == 2) {
|
||||
$o .= "$line\n";
|
||||
} else {
|
||||
$o .= " $line<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -230,7 +230,8 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
|
||||
if(isteacher($course->id)) {
|
||||
$exportdir=$CFG->dataroot."/".$course->id."/".$exportdestinations;
|
||||
} else {
|
||||
die("Hack attack identified !!!");
|
||||
add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to export a wiki as non-teacher into $exportdestinations.");
|
||||
error("You are not a teacher !");
|
||||
}
|
||||
} else {
|
||||
$exportbasedir=tempnam("/tmp","WIKIEXPORT");
|
||||
|
||||
Reference in New Issue
Block a user