X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDispatcher.pm;h=e9f7dac09a7d13ba93530f497165607509535fa8;hb=72be9c763f3b7f7df1fae4fe10011e45f9e2ad1d;hp=03f1c5776bf5ef28af9ef806b82dfdf0aaa6c168;hpb=891411c15c60f4099e7d2f687de8efe84b2e0fbb;p=kivitendo-erp.git diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 03f1c5776..e9f7dac09 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -81,7 +81,6 @@ sub pre_startup_setup { my ($self) = @_; SL::LxOfficeConf->read; - _init_environment(); eval { package main; @@ -96,7 +95,7 @@ sub pre_startup_setup { $::auth = SL::Auth->new; $::form = undef; %::myconfig = (); - %::called_subs = (); # currently used for recursion detection + $::request = undef; } $SIG{__WARN__} = sub { @@ -169,11 +168,10 @@ sub handle_request { $self->unrequire_bin_mozilla; - $::cgi = CGI->new(''); - $::locale = Locale->new($::lx_office_conf{system}->{language}); - $::form = Form->new; - %::called_subs = (); + $::locale = Locale->new($::lx_office_conf{system}->{language}); + $::form = Form->new; $::instance_conf = SL::InstanceConfiguration->new; + $::request = { cgi => CGI->new({}) }; my $session_result = $::auth->restore_session; $::auth->create_or_refresh_session; @@ -241,7 +239,7 @@ sub handle_request { } or do { if ($EVAL_ERROR ne END_OF_REQUEST) { print STDERR $EVAL_ERROR; - $::form->{label_error} = $::cgi->pre($EVAL_ERROR); + $::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR); eval { show_error('generic/error') }; } }; @@ -254,6 +252,7 @@ sub handle_request { $::locale = undef; $::form = undef; $::myconfig = (); + $::request = undef; Form::disconnect_standard_dbh; $::lxdebug->end_request; @@ -311,7 +310,7 @@ sub _route_dispatcher_request { 1; } or do { - $::form->{label_error} = $::cgi->pre($EVAL_ERROR); + $::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR); show_error('generic/error'); }; @@ -328,7 +327,7 @@ sub _route_controller_request { 1; } or do { - $::form->{label_error} = $::cgi->pre($EVAL_ERROR); + $::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR); show_error('generic/error'); }; @@ -370,27 +369,6 @@ sub get_standard_filehandles { return $self->{interface} =~ m/f(?:ast)cgi/i ? $self->{request}->GetHandles() : (\*STDIN, \*STDOUT, \*STDERR); } -sub _init_environment { - my %key_map = ( lib => { name => 'PERL5LIB', append_path => 1 }, - path => { name => 'PATH', append_path => 1 }, - ); - my $cfg = $::lx_office_conf{environment} || {}; - - while (my ($key, $value) = each %{ $cfg }) { - next unless $value; - - my $info = $key_map{$key} || {}; - $key = $info->{name} || $key; - - if ($info->{append_path}) { - $value = ':' . $value unless $value =~ m/^:/ || !$ENV{$key}; - $value = $ENV{$key} . $value; - } - - $ENV{$key} = $value; - } -} - sub _check_for_old_config_files { my @old_files = grep { -f "config/${_}" } qw(authentication.pl console.conf lx-erp.conf lx-erp-local.conf); return unless @old_files;