mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Better fix for Bug #1530 - Wiki diffs useless when using HTML editor
This commit is contained in:
parent
269f7a3d82
commit
bc1f9c7349
5 changed files with 34 additions and 18 deletions
|
@ -172,6 +172,7 @@ $string['contentsize']='Content size';
|
||||||
$string['pageslinkingto']="Pages linking to this page";
|
$string['pageslinkingto']="Pages linking to this page";
|
||||||
$string['viewsmfor']="View sitemap for";
|
$string['viewsmfor']="View sitemap for";
|
||||||
$string['smfor']="Sitemap for";
|
$string['smfor']="Sitemap for";
|
||||||
|
$string['uplinsect']="Upload into";
|
||||||
$string['invalidroot']="You are not authorized to access the current root page so no sitemap can be created.";
|
$string['invalidroot']="You are not authorized to access the current root page so no sitemap can be created.";
|
||||||
$string['thispageisntlinkedfromanywhereelse'] = 'This page isn\'t linked from anywhere else.';
|
$string['thispageisntlinkedfromanywhereelse'] = 'This page isn\'t linked from anywhere else.';
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ Mike:
|
||||||
- Grading
|
- Grading
|
||||||
|
|
||||||
Michael:
|
Michael:
|
||||||
- More Logging
|
- Upload: There is an error when having a bin html-wiki: File does not show up
|
||||||
|
- Log when up- or download
|
||||||
- Notify when page changes
|
- Notify when page changes
|
||||||
|
|
||||||
Unassigned or not ready:
|
Unassigned or not ready:
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
# Check for dangerous events (hacking) !
|
# Check for dangerous events (hacking) !
|
||||||
if(in_array($action,array("removepages","strippages","revertpages"))) {
|
if(in_array($action,array("removepages","strippages","revertpages"))) {
|
||||||
if(!($wiki->wtype=="student" || isteacher($course->id))) {
|
if(!($wiki->wtype=="student" || isteacher($course->id))) {
|
||||||
add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to trick admin.php with $action.");
|
add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to trick admin.php with action=$action.");
|
||||||
error("Hack attack detected !");
|
error("Hack attack detected !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
// No additional info
|
// No additional info
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_to_log($course->id, "wiki", $action, "admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id", $wiki->name.($addloginfo?" ".$addloginfo:""));
|
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";
|
$link="admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id&wikipage=$wikipage";
|
||||||
switch($action) {
|
switch($action) {
|
||||||
case "removepages":
|
case "removepages":
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ function ewiki_page_info($id, &$data, $action) {
|
||||||
##### BEGIN MOODLE ADDITION #####
|
##### BEGIN MOODLE ADDITION #####
|
||||||
$o .= '<a href="' .
|
$o .= '<a href="' .
|
||||||
ewiki_script($action, $id, array("version"=>$current["version"])) .
|
ewiki_script($action, $id, array("version"=>$current["version"])) .
|
||||||
'">' . get_string($title,"wiki") . '</a> ';
|
'">' . get_string($title,"wiki") . '</a> ';
|
||||||
##### END MOODLE ADDITION #####
|
##### END MOODLE ADDITION #####
|
||||||
}
|
}
|
||||||
$o .= "</td></tr>\n";
|
$o .= "</td></tr>\n";
|
||||||
|
|
|
@ -34,17 +34,29 @@
|
||||||
|
|
||||||
# Different handling for html: closes Bug #1530 - Wiki diffs useless when using HTML editor
|
# Different handling for html: closes Bug #1530 - Wiki diffs useless when using HTML editor
|
||||||
if($wiki->htmlmode==2) {
|
if($wiki->htmlmode==2) {
|
||||||
$htmlendings=array("<br />","<br>","</p>","<hr />","<hr>","</li>","</tr>");
|
$htmlendings=array("<br />","<br>","<p>","</p>","<p />","<hr />","<hr>","</li>","</tr>");
|
||||||
$splitregexp="+\s*\n|\s*(".join("|",$htmlendings).")+";
|
/// Replace <p> </p>
|
||||||
$content0=preg_replace("+(".join("|",$htmlendings).")+","\n",$data0["content"]);
|
$content0=preg_replace("+<p> </p>+i","\n",$data0["content"]);
|
||||||
$content=preg_replace("+(".join("|",$htmlendings).")+","\n",$data["content"]);
|
$content0=preg_replace("+(".join("|",$htmlendings).")+","\n",$content0);
|
||||||
|
$content=preg_replace("+<p> </p>+i","\n",$data["content"]);
|
||||||
|
$content=preg_replace("+(".join("|",$htmlendings).")+","\n",$content);
|
||||||
} else {
|
} else {
|
||||||
$splitregexp="/\s*\n/";
|
|
||||||
$content0=$data0["content"];
|
$content0=$data0["content"];
|
||||||
$content=$data["content"];
|
$content=$data["content"];
|
||||||
}
|
}
|
||||||
$txt0 = preg_split($splitregexp, trim($content0));
|
$txt0 = preg_split("+\s*\n+", trim($content0));
|
||||||
$txt2 = preg_split($splitregexp, trim($content));
|
$txt2 = preg_split("+\s*\n+", trim($content));
|
||||||
|
///print "<pre>\n";
|
||||||
|
///print "\$data0[content]:\n $data0[content]\n";
|
||||||
|
///print "\n\n-----------\n\n";
|
||||||
|
///print "\$data[content]:\n $data[content]\n";
|
||||||
|
///print "\n\n-----------\n\n";
|
||||||
|
///print "\$content0:\n $content0\n";
|
||||||
|
///print "\n\n-----------\n\n";
|
||||||
|
///print "\$content:\n $content\n";
|
||||||
|
///print "\n\n-----------\n\n";
|
||||||
|
///print "</pre>";
|
||||||
|
///exit;
|
||||||
|
|
||||||
/// Remove empty lines in html
|
/// Remove empty lines in html
|
||||||
if($wiki->htmlmode==2) {
|
if($wiki->htmlmode==2) {
|
||||||
|
@ -54,14 +66,16 @@
|
||||||
$txt2=array();
|
$txt2=array();
|
||||||
|
|
||||||
for($i=0;$i<count($html0);$i++) {
|
for($i=0;$i<count($html0);$i++) {
|
||||||
if(trim(strip_tags($html0[$i]))) { // There is something !
|
# $linecontent=trim(strip_tags(preg_replace("+ +","",$html0[$i])));
|
||||||
|
# if($linecontent) { // There is something !
|
||||||
$txt0[]=$html0[$i];
|
$txt0[]=$html0[$i];
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
for($i=0;$i<count($html2);$i++) {
|
for($i=0;$i<count($html2);$i++) {
|
||||||
if(trim(strip_tags($html2[$i]))) { // There is something !
|
# $linecontent=trim(strip_tags(preg_replace("+ +","",$html2[$i])));
|
||||||
|
# if($linecontent) { // There is something !
|
||||||
$txt2[]=$html2[$i];
|
$txt2[]=$html2[$i];
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +89,7 @@
|
||||||
$i2 = $i;
|
$i2 = $i;
|
||||||
while ($rm = $diff0[$i2++]) {
|
while ($rm = $diff0[$i2++]) {
|
||||||
if($wiki->htmlmode == 2) {
|
if($wiki->htmlmode == 2) {
|
||||||
$o .= "<br><b>-</b><font color=\"#990000\">$rm</font><br>\n";
|
$o .= "<b>-</b><font color=\"#990000\">$rm</font><br>\n";
|
||||||
} else {
|
} else {
|
||||||
$o .= "<b>-</b><font color=\"#990000\"><tt>$rm</tt></font><br>\n";
|
$o .= "<b>-</b><font color=\"#990000\"><tt>$rm</tt></font><br>\n";
|
||||||
}
|
}
|
||||||
|
@ -84,14 +98,14 @@
|
||||||
|
|
||||||
if (in_array($line, $diff2)) {
|
if (in_array($line, $diff2)) {
|
||||||
if($wiki->htmlmode == 2) {
|
if($wiki->htmlmode == 2) {
|
||||||
$o .= "<br><b>+</b><font color=\"#009900\">$line</font>\n";
|
$o .= "<b>+</b><font color=\"#009900\">$line</font><br>\n";
|
||||||
} else {
|
} else {
|
||||||
$o .= "<b>+</b><font color=\"#009900\"><tt>$line</tt></font><br>\n";
|
$o .= "<b>+</b><font color=\"#009900\"><tt>$line</tt></font><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($wiki->htmlmode == 2) {
|
if($wiki->htmlmode == 2) {
|
||||||
$o .= "$line\n";
|
$o .= "$line<br>\n";
|
||||||
} else {
|
} else {
|
||||||
$o .= " $line<br>\n";
|
$o .= " $line<br>\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue