version 1.60, 2004/08/20 16:29:15
|
version 1.63, 2004/09/10 20:05:03
|
Line 289 sub checksuffix {
|
Line 289 sub checksuffix {
|
} |
} |
|
|
sub cleanDest { |
sub cleanDest { |
my ($request,$dest,$subdir)=@_; |
my ($request,$dest,$subdir,$fn)=@_; |
#remove bad characters |
#remove bad characters |
my $foundbad=0; |
my $foundbad=0; |
if ($subdir && $dest =~/\./) { |
if ($subdir && $dest =~/\./) { |
Line 300 sub cleanDest {
|
Line 300 sub cleanDest {
|
$foundbad=1; |
$foundbad=1; |
$dest=~s/[\#\?&%\"]//g; |
$dest=~s/[\#\?&%\"]//g; |
} |
} |
|
if ($dest=~m|/|) { |
|
my ($newpath)=($dest=~m|(.*)/|); |
|
if (! -d "$fn/$newpath") { |
|
$request->print("<p><font color=\"red\">".&mt('You request to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"<tt>'.$newpath.'</tt>"')."</font></p>"); |
|
$dest=~s|.*/||; |
|
} |
|
} |
if ($foundbad) { |
if ($foundbad) { |
$request->print("<p><font color=\"red\">".&mt('Invalid characters in requested name have been removed.')."</font></p>"); |
$request->print("<p><font color=\"red\">".&mt('Invalid characters in requested name have been removed.')."</font></p>"); |
} |
} |
Line 760 sub phaseone {
|
Line 767 sub phaseone {
|
|
|
my $doingdir=0; |
my $doingdir=0; |
if ($ENV{'form.action'} eq 'newdir') { $doingdir=1; } |
if ($ENV{'form.action'} eq 'newdir') { $doingdir=1; } |
my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir); |
my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir,$fn); |
$newfilename=&relativeDest($fn,$newfilename,$uname); |
$newfilename=&relativeDest($fn,$newfilename,$uname); |
$r->print('<form action="/adm/cfile" method="post">'. |
$r->print('<form action="/adm/cfile" method="post">'. |
'<input type="hidden" name="qualifiedfilename" value="'.$fn.'" />'. |
'<input type="hidden" name="qualifiedfilename" value="'.$fn.'" />'. |
Line 988 sub Copy2 {
|
Line 995 sub Copy2 {
|
unless (copy($oldfile, $newfile)) { |
unless (copy($oldfile, $newfile)) { |
$request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>'); |
$request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>'); |
return 0; |
return 0; |
|
} elsif (!chmod(0660, $newfile)) { |
|
$request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>'); |
|
return 0; |
|
} elsif (-e $oldfile.'.meta' && |
|
!copy($oldfile.'.meta', $newfile.'.meta') && |
|
!chmod(0660, $newfile.'.meta')) { |
|
$request->print('<font color="red"> '.&mt('copy metadata error'). |
|
': '.$!.'</font>'); |
|
return 0; |
} else { |
} else { |
unless (chmod(0660, $newfile)) { |
|
$request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>'); |
|
return 0; |
|
} |
|
return 1; |
return 1; |
} |
} |
} else { |
} else { |
Line 1118 sub phasetwo {
|
Line 1130 sub phasetwo {
|
return ; |
return ; |
} |
} |
$dest = $dir."/."; |
$dest = $dir."/."; |
} elsif ($ENV{'form.action'} eq 'rename') { # Rename. |
} elsif ($ENV{'form.action'} eq 'rename' || |
|
$ENV{'form.action'} eq 'move') { |
if($ENV{'form.newfilename'}) { |
if($ENV{'form.newfilename'}) { |
if (!defined($dir)) { |
if (!defined($dir)) { |
$fn=~m:^(.*)/:; |
$fn=~m:^(.*)/:; |