[ Avaa Bypassed ]




Upload:

Command:

www-data@18.189.188.228: ~ $
# Functions for editing /etc/mailcap

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();

if ($module_info{'usermin'}) {
	&switch_to_remote_user();
	&create_user_config_dirs();
	$mailcap_file = $userconfig{'mailcap'};
	if ($mailcap_file !~ /^\//) {
		$mailcap_file = "$remote_user_info[7]/$mailcap_file";
		}
	}
else {
	$mailcap_file = $config{'mailcap'};
	}

# list_mailcap()
# Returns a list of /etc/mailcap entries
sub list_mailcap
{
if (!scalar(@list_mailcap_cache)) {
  @list_mailcap_cache = ( );
  open(CAP, "<".$mailcap_file);
  local $lnum = 0;
  while(<CAP>) {
	  local ($slnum, $elnum) = ($lnum, $lnum);
	  s/\r|\n//g;
	  while (/^(.*)\\/) {
		# Continuation line! Read the next one and append it
		local $before = $1;
		local $nxt = <CAP>;
		$nxt =~ s/\r|\n//g;
		$_ = $before.$nxt;
		$elnum++;
		}
	  if (/^(#*)\s*([a-z0-9\-]+)\/([a-z0-9\-\*]+);\s*([^;]*)(;(.*))?/) {
		  # Found a line
		  local @cmtlines = split(/\n/, $cmt);
		  local $cap = { 'type' => $2."/".$3,
				 'program' => $4,
				 'enabled' => !$1,
				 'cmt' => $cmt,
				 'args' => { },
				 'line' => $slnum-scalar(@cmtlines),
				 'eline' => $elnum,
				 'index' => scalar(@list_mailcap_cache),
			       };
		  # Parse ; separated args after the command
		  local $args = $6;
		  local @args = split(/\s*;\s*/, $args);
		  foreach my $arg (@args) {
			if ($arg =~ /^\s*(\S+)\s*=\s*(.*)/) {
				# A name-value arg
				$cap->{'args'}->{$1} = $2;
				}
			elsif ($arg =~ /^\s*(\S+)\s*$/) {
				$cap->{'args'}->{$1} = "";
				}
			}
		  push(@list_mailcap_cache, $cap);
		  $cmt = undef;
		  }
	  elsif (/^#+(.*)/) {
		  # Found a comment before a rule
		  if ($cmt) {
			$cmt .= "\n".$1;
			}
		  else {
			$cmt = $1;
			}
		  }
	  else {
		  $cmt = undef;
		  }
	  $lnum++;
	  }
  close(CAP);
  }
return @list_mailcap_cache;
}

# create_mailcap(&mailcap)
# Adds a mailcap entry
sub create_mailcap
{
local ($mailcap) = @_;
&list_mailcap();  # init cache
local $lref = &read_file_lines($mailcap_file);
local @lines = &mailcap_lines($mailcap);
$mailcap->{'line'} = scalar(@$lref);
$mailcap->{'eline'} = scalar(@$lref)+scalar(@lines)-1;
$mailcap->{'index'} = scalar(@list_mailcap_cache);
push(@$lref, @lines);
&flush_file_lines($mailcap_file);
push(@list_mailcap_cache, $mailcap);
}

# modify_mailcap(&mailcap)
# Updates one mailcap entry in the file
sub modify_mailcap
{
local ($mailcap) = @_;
local $lref = &read_file_lines($mailcap_file);
local @lines = &mailcap_lines($mailcap);
local $oldlen = $mailcap->{'eline'} - $mailcap->{'line'} + 1;
splice(@$lref, $mailcap->{'line'}, $oldlen, @lines);
&flush_file_lines($mailcap_file);
local $diff = scalar(@lines)-$oldlen;
foreach my $c (grep { $c ne $mailcap } @list_mailcap_cache) {
  $c->{'line'} += $diff if ($c->{'line'} > $mailcap->{'line'});
  $c->{'eline'} += $diff if ($c->{'eline'} > $mailcap->{'line'});
  }
}

# delete_mailcap(&mailcap)
# Removes one mailcap entry from the file
sub delete_mailcap
{
local ($mailcap) = @_;
local $lref = &read_file_lines($mailcap_file);
local $len = $mailcap->{'eline'} - $mailcap->{'line'} + 1;
splice(@$lref, $mailcap->{'line'}, $len);
&flush_file_lines($mailcap_file);
@list_mailcap_cache = grep { $_ ne $mailcap } @list_mailcap_cache;
foreach my $c (@list_mailcap_cache) {
  $c->{'line'} -= $len if ($c->{'line'} > $mailcap->{'line'});
  $c->{'eline'} -= $len if ($c->{'eline'} > $mailcap->{'line'});
  $c->{'index'}-- if ($c->{'index'} > $mailcap->{'index'});
  }
}

# mailcap_lines(&mailcap)
# Returns an array of lines for a mailcap entry
sub mailcap_lines
{
local ($mailcap) = @_;
local @rv;
local $args;
foreach my $a (keys %{$mailcap->{'args'}}) {
	local $v = $mailcap->{'args'}->{$a};
	if ($v eq '') {
		$args .= "; $a";
		}
	else {
		$args .= "; $a=$v";
		}
	}
foreach my $l (split(/\n/, $mailcap->{'cmt'})) {
	push(@rv, "#$l");
	}
push(@rv, ($mailcap->{'enabled'} ? "" : "#").
          "$mailcap->{'type'}; $mailcap->{'program'}".$args);
return @rv;
}

1;


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
CHANGELOG File 252 B 0644
backup_config.pl File 585 B 0755
cgi_args.pl File 193 B 0755
config File 21 B 0644
config.info File 34 B 0644
config.info.ca File 44 B 0644
config.info.de File 34 B 0644
config.info.hu File 0 B 0644
config.info.ja_JP.UTF-8 File 45 B 0644
config.info.ko File 42 B 0644
config.info.ms File 34 B 0644
config.info.nl File 35 B 0644
config.info.no File 38 B 0644
config.info.pl File 38 B 0644
delete.cgi File 1.03 KB 0755
edit.cgi File 2 KB 0755
index.cgi File 1.23 KB 0755
log_parser.pl File 527 B 0755
mailcap-lib.pl File 3.86 KB 0755
module.info File 167 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 121 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 150 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 180 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 202 B 0644
module.info.ca File 128 B 0644
module.info.cs File 27 B 0644
module.info.cs.auto File 86 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 123 B 0644
module.info.de File 116 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 230 B 0644
module.info.es File 0 B 0644
module.info.es.auto File 113 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 124 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 186 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 125 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 130 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 142 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 121 B 0644
module.info.hu File 32 B 0644
module.info.hu.auto File 103 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 121 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 160 B 0644
module.info.ko File 33 B 0644
module.info.ko.auto File 109 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 114 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 137 B 0644
module.info.ms File 118 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 124 B 0644
module.info.nl File 30 B 0644
module.info.nl.auto File 77 B 0644
module.info.no File 29 B 0644
module.info.no.auto File 91 B 0644
module.info.pl File 129 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 128 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 134 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 135 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 199 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 113 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 117 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 107 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 203 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 120 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 183 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 195 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 145 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 109 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 115 B 0644
save.cgi File 1.89 KB 0755