default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / config / config-download.cgi
1 <%init>
2 die "access denied"
3   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
4
5 my $agentnum;
6 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
7   $agentnum = $1;
8 }
9
10 http_header('Content-Type' => 'application/x-unknown' );
11
12 die "No configuration variable specified (bad URL)!" # umm
13   unless $cgi->param('key');
14 $cgi->param('key') =~  /^([-\w.]+)$/;
15 my $name = $1;
16
17 my $agentnum;
18 if ($cgi->param('agentnum') =~ /^(\d+)$/) {
19   $agentnum = $1;
20 }
21
22 my $locale = '';
23 if ($cgi->param('locale') =~ /^(\w+)$/) {
24   $locale = $1;
25 }
26 my $conf=new FS::Conf { 'locale' => $locale };
27
28 http_header('Content-Disposition' => "attachment; filename=$name" );
29 print $conf->config_binary($name, $agentnum);
30 </%init>