X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/540c0b5e9a38158e6f7a6efacd20b2477efad7ac..3be85e174a63158503c333e7f0682abfc969bf8b:/SL/Dispatcher.pm diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index f6c9f60cf..43bf6680b 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -2,9 +2,18 @@ package SL::Dispatcher; use strict; +# Force scripts/locales.pl to parse these templates: +# parse_html_template('login_screen/auth_db_unreachable') +# parse_html_template('login_screen/user_login') +# parse_html_template('generic/error') + BEGIN { - unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML). - push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. + use SL::System::Process; + my $exe_dir = SL::System::Process::exe_dir; + + unshift @INC, "${exe_dir}/modules/override"; # Use our own versions of various modules (e.g. YAML). + push @INC, "${exe_dir}/modules/fallback"; # Only use our own versions of modules if there's no system version. + unshift @INC, $exe_dir; } use CGI qw( -no_xhtml); @@ -200,7 +209,13 @@ sub handle_request { $::form->error($::locale->text('System currently down for maintenance!')) if -e ($::lx_office_conf{paths}->{userspath} . "/nologin") && $script ne 'admin'; - ($routing_type, $script, $script_name, $action) = qw(controller controller LoginScreen login) if ($script eq 'login') && ($action eq 'login'); + # For compatibility with a lot of database upgrade scripts etc: + # Re-write request to old 'login.pl?action=login' to new + # 'LoginScreen' controller. Make sure to load its code! + if (($script eq 'login') && ($action eq 'login')) { + ($routing_type, $script, $script_name, $action) = qw(controller controller LoginScreen login); + _require_controller('LoginScreen'); + } if (($script eq 'login') && !$action) { print $::request->{cgi}->redirect('controller.pl?action=LoginScreen/user_login'); @@ -243,6 +258,7 @@ sub handle_request { if ($EVAL_ERROR ne END_OF_REQUEST) { print STDERR $EVAL_ERROR; $::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR); + chdir SL::System::Process::exe_dir; eval { show_error('generic/error') }; } };