MySQL-Admin
view release on metacpan or search on metacpan
cgi-bin/Content/files.pl view on Meta::CPAN
sprintf( "%s", $sb->size ),
( $^O ne 'MSWin32' ? sprintf( "%04o", $sb->mode & 07777 ) : '' ),
( $^O ne 'MSWin32' ? getpwuid( $sb->uid )->name : '' ),
( $^O ne 'MSWin32' ? $sb->gid : '' ),
"$year-$mon-$mday $hour:$min:$sec",
qq|<table cellpading="0" cellspacing="0">
<tr><td class="batch"><a class="treeviewLink16" href="javascript:prompt('Enter Filename:',function(a){if(a != null )requestURI('$m_hrSettings->{cgi}{serverName}$ENV{SCRIPT_NAME}?action=renameFile&file=$efl&newName=...
. (
$^O ne 'MSWin32'
? qq|<td class="batch"><a class="treeviewLink16" href="javascript:prompt('Enter User:',function(c){ a = c; prompt('Enter Group:',function(b){ if(a != null && b != null)requestURI('$m_hrSettings->{cgi}{serverNa...
: ''
)
. (
$^O ne 'MSWin32'
? qq|<td class="batch"><a class="treeviewLink16" href="javascript:prompt('Enter Chmod: 0755',function(a){if(a != null )requestURI('$m_hrSettings->{cgi}{serverName}$ENV{SCRIPT_NAME}?action=chmodFile&file=$efl&ch...
: ''
)
. qq|<td class="batch"><a class="treeviewLink16" href="javascript:confirm2('$trdelete ?',function(a){requestURI('$m_hrSettings->{cgi}{serverName}$ENV{SCRIPT_NAME}?action=deleteFile&file=$efl','deleteFile','delete...
</td></tr></table>|
],
};
last TYPE;
} ## end if ( -d $fl )
if ( -f $fl ) {
my $suffix = $d =~ /\.([^\.]+)$/ ? $1 : '';
push @TREEVIEW, {
text => "$d",
href => "$href",
mtime => $sb->mtime,
size => $sb->size,
columns => [
sprintf( "%s", $sb->size ),
sprintf( "%04o", $sb->mode & 07777 ),
( $^O ne 'MSWin32' ? getpwuid( $sb->uid )->name : '' ),
$sb->gid,
"$year-$mon-$mday $hour:$min:$sec",
qq|
<table cellpading="0" cellspacing="0"><tr>
<td class="batch" style="font-size:14px;"><a class="treeviewLink16" href="javascript:prompt('Enter Filename:',function(a){if(a != null )requestURI('$m_hrSettings->{cgi}{serverName}$ENV{SCRIPT_NAME}?action=renameFile&file=$efl&newName='+...
|
. (
$^O ne 'MSWin32'
? qq|<td class="batch" style="font-size:14px;"><a class="treeviewLink16" href="javascript:prompt('Enter User:',function(c){a=c;prompt('Enter Group:',function(b){if(a != null && b != null)requestURI('$m_hrSetti...
: ''
)
. (
$^O ne 'MSWin32'
? qq|<td class="batch" style="font-size:14px;"><a class="treeviewLink16" href="javascript:prompt('Enter Chmod: 0755',function(a){;if(a != null )requestURI('$m_hrSettings->{cgi}{serverName}$ENV{SCRIPT_NAME}?acti...
: ''
)
. qq|<td class="batch" style="font-size:14px;"><a class="treeviewLink16" href="javascript:confirm2('$trdelete ?',function(a){requestURI('$m_hrSettings->{cgi}{serverName}$ENV{SCRIPT_NAME}?action=deleteFile&file=$e...
</tr></table>|,
],
image => ( -e "$m_hrSettings->{cgi}{DocumentRoot}/style/$m_sStyle/$m_hrSettings->{size}/mimetypes/$suffix.png" )
? "$suffix.png"
: 'link_overlay.png',
};
} ## end if ( -f $fl )
} ## end TYPE:
} ## end foreach my $d ( readdir(DIR...))
$r = 0;
return @TREEVIEW;
} ## end if ( -d "$dir" && -r "$dir")
} ## end sub readFiles
sub FileOpen {
my $f = defined param('file') ? param('file') : shift;
return unless defined $f;
SWITCH: {
if ( -d $f ) {
&showDir($f);
last SWITCH;
} ## end if ( -d $f )
if ( -T $f ) {
my $content = openFile($f);
&showEditor( $f, $content, 'saveFile', $f );
last SWITCH;
} else {
print br() . qq(<div align="center">) . translate('no_ascii_file') . "</div>";
} ## end else [ if ( -T $f ) ]
if ( $f =~ /png|jpg|jpeg|gif$/ && $f =~ m~/var/www/htdocs/(.*)$~ ) {
print br() . qq(<div align="center"><img alt="" src="/$1" align="center"/>) . br() . "</div>";
last SWITCH;
} ## end if ( $f =~ /png|jpg|jpeg|gif$/...)
print br() . translate("UnsopportedFileType") . br();
} ## end SWITCH:
} ## end sub FileOpen
sub saveFile {
my $txt = param('txt');
my $sFile = param('file');
# $txt =~ s/\r\n/\n/g;
my $fh = gensym();
unless ( -d $sFile ) {
open $fh, ">:encoding(UTF-8)", "$sFile.bak" or warn "files.pl::saveFile $/ $! $/ $sFile $/";
flock $fh, 2;
seek $fh, 0, 0;
truncate $fh, 0;
print $fh $txt;
close $fh;
rename "$sFile.bak", $sFile or warn "files.pl::saveFile $/ $! $/" if ( -e "$sFile.bak" );
chmod( 0755, $sFile ) if ( $sFile =~ m?\.pl? && $^O ne 'MSWin32' );
FileOpen($sFile);
} elsif ( defined param('title') && defined param('file') ) {
my $sf = param('file') . '/' . param('title');
open $fh, ">$sf.bak" or warn "files.pl::saveFile $/ $! $/ $sf $/";
flock $fh, 2;
seek $fh, 0, 0;
truncate $fh, 0;
print $fh $txt;
close $fh;
rename "$sf.bak", $sf or warn "files.pl::saveFile $/ $! $/" if ( -e "$sf.bak" );
FileOpen($sf);
} ## end elsif ( defined param('title'...))
} ## end sub saveFile
( run in 1.825 second using v1.01-cache-2.11-cpan-39bf76dae61 )