summaryrefslogtreecommitdiff
path: root/httemplate/config/config-download.cgi
blob: c071f2a6d208e4e22fac246a957b0e7749cd0e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<%init>
die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $agentnum;
if ($cgi->param('agentnum') =~ /^(\d+)$/) {
  $agentnum = $1;
}

http_header('Content-Type' => 'application/x-unknown' );

die "No configuration variable specified (bad URL)!" # umm
  unless $cgi->param('key');
$cgi->param('key') =~  /^([-\w.]+)$/;
my $name = $1;

my $agentnum;
if ($cgi->param('agentnum') =~ /^(\d+)$/) {
  $agentnum = $1;
}

my $locale = '';
if ($cgi->param('locale') =~ /^(\w+)$/) {
  $locale = $1;
}
my $conf=new FS::Conf { 'locale' => $locale };

http_header('Content-Disposition' => "attachment; filename=$name" );
print $conf->config_binary($name, $agentnum);
</%init>