--- loncom/publisher/loncleanup.pm 2005/05/29 01:46:16 1.4
+++ loncom/publisher/loncleanup.pm 2008/12/24 07:58:34 1.10
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to cleanup XML files
#
-# $Id: loncleanup.pm,v 1.4 2005/05/29 01:46:16 www Exp $
+# $Id: loncleanup.pm,v 1.10 2008/12/24 07:58:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -38,6 +38,9 @@ use Apache::loncacc;
use Apache::loncommon();
use Apache::lonlocal;
use Apache::lonnet;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+
sub latextrans {
my $symbolfont=shift;
@@ -218,8 +221,9 @@ sub htmlclean {
}
# Generate empty tags, remove wrong end tags
unless ($blockemptytags) {
- $raw=~s/\<(br|hr|img|meta|allow|basefont)([^\>\/]*?)\>/\<$1$2 \/\>/gis;
- $raw=~s/\<\/(br|hr|img|meta|allow|basefont)\>//gis;
+ $raw=~s/\<(br|hr|img|meta|embed|allow|basefont)([^\>]*?)\>/\<$1$2 \/\>/gis;
+ $raw=~s/\<\/(br|hr|img|meta|embed|allow|basefont)\>//gis;
+ $raw=~s/\/ \/\>/\/\>/gs;
unless ($full) {
$raw=~s/\<[\/]*(body|head|html)\>//gis;
}
@@ -293,9 +297,9 @@ sub phasetwo {
$warningcount.' '.&mt('warning(s)').
'
'.
&mt('Open (and edit) cleaned up file in new window').''.
- '
'.
+ &escape($newuri).'" target="prev">'.
&mt('Show diffs in new window').'
'.
''.
''.
@@ -331,7 +335,7 @@ sub handler {
if ($env{'form.filename'}) {
$fn=$env{'form.filename'};
- $fn=~s/^http\:\/\/[^\/]+//;
+ $fn=~s/^https?\:\/\/[^\/]+//;
} else {
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
' unspecified filename for cleanup', $r->filename);
@@ -358,14 +362,12 @@ sub handler {
return HTTP_NOT_ACCEPTABLE;
}
- $fn=~s/\/\~(\w+)//;
+ $fn=~s{/~($LONCAPA::username_re)}{};
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- $r->print('