--- loncom/interface/londocs.pm 2005/01/08 06:34:30 1.163 +++ loncom/interface/londocs.pm 2005/01/08 06:42:15 1.164 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.163 2005/01/08 06:34:30 albertel Exp $ +# $Id: londocs.pm,v 1.164 2005/01/08 06:42:15 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -132,6 +132,11 @@ sub dumpbutton { } } +sub clean { + my ($title)=@_; + $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; + return $title; +} # -------------------------------------------------------- Actually dump course sub dumpcourse { @@ -149,7 +154,7 @@ sub dumpcourse { my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'}); $r->print('

'.&mt('Copying Files').'

'); my $title=$ENV{'form.authorfolder'}; - $title=~s/[^\w\/]+/\_/g; + $title=&clean($title); my %replacehash=(); foreach (keys %ENV) { if ($_=~/^form\.namefor\_(.+)/) { @@ -160,7 +165,7 @@ sub dumpcourse { $crs=~s/\_/\//g; foreach (keys %replacehash) { my $newfilename=$title.'/'.$replacehash{$_}; - $newfilename=~s/[^\w\/\.\/]+/\_/g; + $newfilename=&clean($newfilename); my @dirs=split(/\//,$newfilename); my $path='/home/'.$ca.'/public_html'; my $makepath=$path; @@ -214,7 +219,7 @@ sub dumpcourse { } my $title=$origcrsdata{'description'}; $title=~s/\s+/\_/gs; - $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; + $title=&clean($title); $r->print('

'.&mt('Folder in Construction Space').'


'); &tiehash(); $r->print('

'.&mt('Filenames in Construction Space').'

'); @@ -229,7 +234,7 @@ sub dumpcourse { $title=$_; } $title=~s/\.(\w+)$//; - $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; + $title=&clean($title); $title.='.'.$ext; $r->print("\n\n"); }
'.&mt('Internal Filename').''.&mt('Title').''.&mt('Save as ...').'