6 # FIXME: move this to Apache handler?
8 use OpenXPKI::Client::HTML::Mason;
9 use OpenXPKI::Client::HTML::Mason::Javascript;
10 use OpenXPKI::Client::HTML::Mason::Menu;
11 use OpenXPKI::i18n qw( i18nGettext set_language get_language set_locale_prefix );
16 use CGI::Session qw/-ip-match/;
18 if (defined $ENV{OPENXPKI_LOCALE_PREFIX}) {
19 set_locale_prefix($ENV{OPENXPKI_LOCALE_PREFIX});
21 $context->{socket_file} = $ENV{OPENXPKI_SOCKET_FILE};
23 if (defined $ENV{OPENXPKI_DEBUG_FILE}) {
24 open $context->{debugfh}, ">>", $ENV{OPENXPKI_DEBUG_FILE};
26 $context->{debug} = sub {
28 my $fh = $context->{debugfh};
30 local $OUTPUT_AUTOFLUSH = 1;
31 print $fh $arg . "\n";
35 # guard against XSS attacks
36 $m->interp->set_escape(
37 h => \&HTML::Mason::Escapes::basic_html_escape,
42 ## if there is a session and we are not in the authentication process
43 ## then re-use the session
44 if (defined $__session_id and
45 0 > index ($m->request_comp()->title(), "authentication/"))
47 $m->comp('/authentication/session.mhtml', '__session_id' => $__session_id);
48 $m->comp('/authentication/role.mhtml') if ($context and not exists $context->{role});
52 $m->comp ('/lib/language.mhtml', "session_id" => $__session_id);
55 # this is the toplevel handler