X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/23f79a876613fabf7f4aa2de230788ebeb840de9..f07df483ee9e755f29fe599424a1ba2ed8bcc6b8:/SL/Dispatcher.pm diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index e6aa54774..687c37306 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -9,11 +9,15 @@ BEGIN { } use CGI qw( -no_xhtml); +use Config::Std; +use DateTime; +use Encode; use English qw(-no_match_vars); use SL::Auth; use SL::LXDebug; use SL::Locale; use SL::Common; +use SL::Helper::DateTime; use Form; use List::Util qw(first); use File::Basename; @@ -90,6 +94,9 @@ sub pre_startup_setup { $::form = undef; %::myconfig = (); %::called_subs = (); # currently used for recursion detection + + read_config 'config/lx_office.conf' => %::lx_office_conf if -f "config/lx_office.conf"; + _decode_recursively(\%::lx_office_conf); } $SIG{__WARN__} = sub { @@ -147,7 +154,8 @@ sub _run_controller { } sub handle_request { - my $self = shift; + my $self = shift; + $self->{request} = shift; $::lxdebug->enter_sub; $::lxdebug->begin_request; @@ -233,7 +241,7 @@ sub handle_request { $::locale = undef; $::form = undef; $::myconfig = (); - Form::disconnect_standard_dbh(); + Form::disconnect_standard_dbh unless $self->_interface_is_fcgi; $::lxdebug->end_request; $::lxdebug->leave_sub; @@ -241,7 +249,7 @@ sub handle_request { sub unrequire_bin_mozilla { my $self = shift; - return unless $self->{interface} =~ m/^(?:fastcgi|fcgid|fcgi)$/; + return unless $self->_interface_is_fcgi; for (keys %INC) { next unless m#^bin/mozilla/#; @@ -251,6 +259,11 @@ sub unrequire_bin_mozilla { } } +sub _interface_is_fcgi { + my $self = shift; + return $self->{interface} =~ m/^(?:fastcgi|fcgid|fcgi)$/; +} + sub _route_request { my $script_name = shift; @@ -306,6 +319,24 @@ sub _route_controller_request { return ($controller, $action); } +sub get_standard_filehandles { + my $self = shift; + + return $self->{interface} =~ m/f(?:ast)cgi/i ? $self->{request}->GetHandles() : (\*STDIN, \*STDOUT, \*STDERR); +} + +sub _decode_recursively { + my ($obj) = @_; + + while (my ($key, $value) = each %{ $obj }) { + if (ref($value) eq 'HASH') { + _decode_recursively($value); + } else { + $obj->{$key} = decode('UTF-8', $value); + } + } +} + package main; use strict;