version 1.18, 2002/09/10 02:31:26
|
version 1.20, 2002/11/27 17:05:50
|
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 603 sub Copy1 {
|
Line 604 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 |
|
|
Does all phase 1 processing of directory creation: |
Does all phase 1 processing of directory creation: |
Line 988 sub phasetwo {
|
Line 1017 sub phasetwo {
|
# Once a resource is deleted, we just list the directory that |
# Once a resource is deleted, we just list the directory that |
# previously held it. |
# previously held it. |
# |
# |
$dest = $dir."/"; # Parent dir. |
$dest = $dir."/."; # Parent dir. |
} elsif ($ENV{'form.action'} eq 'copy') { |
} elsif ($ENV{'form.action'} eq 'copy') { |
if($ENV{'form.newfilename'}) { |
if($ENV{'form.newfilename'}) { |
if(!&Copy2($r, $uname, $dir, $fn, $ENV{'form.newfilename'})) { |
if(!&Copy2($r, $uname, $dir, $fn, $ENV{'form.newfilename'})) { |
Line 1017 sub phasetwo {
|
Line 1046 sub phasetwo {
|
# construction space path. |
# construction space path. |
# |
# |
&Debug($r, "Final url is: $dest"); |
&Debug($r, "Final url is: $dest"); |
$dest =~ s/\/home\//\/priv\//; |
$dest =~ s|/home/|/priv/|; |
$dest =~ s/\/public_html//; |
$dest =~ s|/public_html||; |
|
|
my $base = &File::Basename::basename($dest); |
my $base = &File::Basename::basename($dest); |
my $dpath= &File::Basename::dirname($dest); |
my $dpath= &File::Basename::dirname($dest); |
|
if ($base eq '.') { $base=''; } |
$dest = &HTML::Entities::encode($dpath.'/'.$base); |
$dest = &HTML::Entities::encode($dpath.'/'.$base); |
|
|
|
|