diff options
author | ivan <ivan> | 2007-08-01 22:26:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-01 22:26:52 +0000 |
commit | eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd (patch) | |
tree | bb38241e8c865c3bca861da7749071feeadd2b5b /httemplate/view/logo.cgi | |
parent | 32b5d3a31f112a381f0a15ac5e3a2204242f3405 (diff) |
event refactor, landing on HEAD!
Diffstat (limited to 'httemplate/view/logo.cgi')
-rw-r--r-- | httemplate/view/logo.cgi | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/httemplate/view/logo.cgi b/httemplate/view/logo.cgi new file mode 100644 index 000000000..aeca0f3b3 --- /dev/null +++ b/httemplate/view/logo.cgi @@ -0,0 +1,47 @@ +<% $data %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $conf = new FS::Conf; + +my $type; +if ( $cgi->param('type') eq 'png' ) { + $type = 'png'; +} elsif ( $cgi->param('type') eq 'eps' ) { + $type = 'eps'; +} else { + die "unknown logo type ". $cgi->param('type'); +} + +my $data; +if ( $cgi->param('preview_session') =~ /^(\w+)$/ ) { + + my $session = $1; + my $curuser = $FS::CurrentUser::CurrentUser; + $data = decode_base64( $curuser->option("logo_preview$session") ); + +} elsif ( $cgi->param('name') =~ /^([^\.\/]*)$/ ) { + + my $templatename = $1; + if ( $templatename && $conf->exists("logo_$templatename.$type") ) { + $templatename = "_$templatename"; + } else { + $templatename = ''; + } + + if ( $type eq 'png' ) { + $data = $conf->config_binary("logo$templatename.png"); + } elsif ( $type eq 'eps' ) { + #convert EPS to a png... punting on that for now + } + +} else { + die "neither a valid name nor a valid preview_session specified"; +} + +http_header('Content-Type' => 'image/png' ); + +</%init> + |