version 1.18, 2002/09/10 02:31:26
|
version 1.19, 2002/10/28 23:23:41
|
Line 493 sub Rename1 {
|
Line 493 sub Rename1 {
|
my $newfilename = $ENV{'form.newfilename'}; |
my $newfilename = $ENV{'form.newfilename'}; |
$request->print(&checksuffix($filename, $newfilename)); |
$request->print(&checksuffix($filename, $newfilename)); |
$request->print(&exists($user, $domain, $dir, $newfilename)); |
$request->print(&exists($user, $domain, $dir, $newfilename)); |
|
my $dest=&SimplifyDir($dir,$newfilename); |
$request->print('<input type=hidden name=newfilename value="'. |
$request->print('<input type=hidden name=newfilename value="'. |
$newfilename. |
$newfilename. |
'"><p>Rename <tt>'.$filename.'</tt> to <tt>'. |
'"><p>Rename <tt>'.$filename.'</tt><br /> to <tt>'. |
$dir.'/'.$newfilename.'</tt>?</p>'); |
$dest.'</tt>?</p>'); |
&CloseForm1($request, $cancelurl); |
&CloseForm1($request, $cancelurl); |
} else { |
} else { |
$request->print('<p>No new filename specified</p></form>'); |
$request->print('<p>No new filename specified</p></form>'); |
Line 587 sub Copy1 {
|
Line 588 sub Copy1 {
|
$cancelurl =~ s/\/public_html//; |
$cancelurl =~ s/\/public_html//; |
|
|
|
|
|
|
if(-e $filename) { |
if(-e $filename) { |
$request->print(&checksuffix($filename,$newfilename)); |
$request->print(&checksuffix($filename,$newfilename)); |
$request->print(&exists($user, $domain, $dir, $newfilename)); |
$request->print(&exists($user, $domain, $dir, $newfilename)); |
|
my $dest=&SimplifyDir($dir,$newfilename); |
$request->print('<input type = hidden name = newfilename value = "'. |
$request->print('<input type = hidden name = newfilename value = "'. |
$dir.'/'.$newfilename. |
$dir.'/'.$newfilename. |
'"><p>Copy <tt>'.$filename.'</tt> to'. |
'"><p>Copy <tt>'.$filename.'</tt><br /> to '. |
'<tt>'.$dir.'/'.$newfilename.'</tt>/?</p>'); |
'<tt>'.$dest.'</tt>?</p>'); |
&CloseForm1($request, $cancelurl); |
&CloseForm1($request, $cancelurl); |
} else { |
} else { |
$request->print('<p>No such file <tt>'.$filename.'</p></form>'); |
$request->print('<p>No such file <tt>'.$filename.'</p></form>'); |
Line 602 sub Copy1 {
|
Line 603 sub Copy1 {
|
} |
} |
|
|
=pod |
=pod |
|
|
|
=item SimplifyDir |
|
|
|
Removes all extra / and all .. references |
|
|
|
Parameters: |
|
|
|
=over 4 |
|
|
|
=item $dir - string [in] a directory name |
|
|
|
=item $file - string [in] a file reference relative to $dir |
|
|
|
=back |
|
|
|
Results: the concatenated path. |
|
|
|
=cut |
|
|
|
sub SimplifyDir { |
|
my ($dir,$file) = @_; |
|
my $location = $dir. '/'.$file; |
|
$location=~s://+:/:g; # remove duplicate / |
|
while ($location=~m:/\.\./:) {$location=~s:/[^/]+/\.\./:/:g;}#remove dir/.. |
|
return $location; |
|
} |
|
|
|
=pod |
|
|
=item NewDir1 |
=item NewDir1 |
|
|