Permalink
Browse files

Better Logging

  • Loading branch information...
1 parent 9e12b9e commit 829e6350337bad6f6e7cb87367f3f85f1beef7c8 skaldrom committed Jun 6, 2004
Showing with 38 additions and 5 deletions.
  1. +21 −1 mod/wiki/admin.php
  2. +15 −3 mod/wiki/ewiki/plugins/moodle/diff.php
  3. +2 −1 mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
View
@@ -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 @@ function ewiki_page_stupid_diff($id, $data, $action) {
}
$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 .= "&nbsp; $line<br>\n";
+ if($wiki->htmlmode == 2) {
+ $o .= "$line\n";
+ } else {
+ $o .= "&nbsp; $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");

0 comments on commit 829e635

Please sign in to comment.