X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDispatcher.pm;h=2c0539bb899e2015287cccba63692de1f3063ea4;hb=fb1e65086b66bac948150bbc1e8fd6e300c21823;hp=3b64e48c3b82ed7c58fc6a87c8841555ff41473e;hpb=d8b7e4d092f7c48c3caac6106de4837390fe6323;p=kivitendo-erp.git diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 3b64e48c3..2c0539bb8 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -16,9 +16,6 @@ use SL::Locale; use SL::Common; use Form; use List::Util qw(first); -use Moose; -use Rose::DB; -use Rose::DB::Object; use File::Basename; # Trailing new line is added so that Perl will not add the line @@ -26,7 +23,14 @@ use File::Basename; use constant END_OF_REQUEST => "END-OF-REQUEST\n"; sub pre_request_checks { - show_error('login/auth_db_unreachable') unless $::auth->session_tables_present; + if (!$::auth->session_tables_present) { + if ($::form->{script} eq 'admin.pl') { + ::run(); + ::end_of_request(); + } else { + show_error('login/auth_db_unreachable'); + } + } $::auth->expire_sessions; } @@ -64,16 +68,23 @@ sub pre_startup_setup { require "bin/mozilla/installationcheck.pl"; } or die $EVAL_ERROR; - # dummy globals + # canonial globals. if it's not here, chances are it will get refactored someday. { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; - $::memberfile = "users/members"; - $::sendmail = "| /usr/sbin/sendmail -t"; - $::lxdebug = LXDebug->new; - $::auth = SL::Auth->new; - %::myconfig = (); + $::userspath = "users"; + $::templates = "templates"; + $::memberfile = "users/members"; + $::menufile = "menu.ini"; + $::sendmail = "| /usr/sbin/sendmail -t"; + $::lxdebug = LXDebug->new; + $::auth = SL::Auth->new; + $::form = undef; + %::myconfig = (); + %::called_subs = (); # currently used for recursion detection + } + + $SIG{__WARN__} = sub { + $::lxdebug->warn(@_); } } @@ -87,6 +98,7 @@ sub pre_startup { } sub require_main_code { + $::lxdebug->enter_sub; my ($script, $suffix) = @_; eval { @@ -101,13 +113,14 @@ sub require_main_code { }; $::form->error($EVAL_ERROR) if ($EVAL_ERROR); } - if ($::form->{login} && -f "bin/mozilla/$::form->{login}_$::form->{script}") { + if ($::form->{login} && -f "bin/mozilla/$::form->{login}_$script") { eval { package main; - require "bin/mozilla/$::form->{login}_$::form->{script}"; + require "bin/mozilla/$::form->{login}_$script"; }; $::form->error($EVAL_ERROR) if ($EVAL_ERROR); } + $::lxdebug->leave_sub; } sub handle_request { @@ -125,9 +138,10 @@ sub handle_request { $script_name = $0; } - $::cgi = CGI->new(''); - $::locale = Locale->new($::language); - $::form = Form->new; + $::cgi = CGI->new(''); + $::locale = Locale->new($::language); + $::form = Form->new; + %::called_subs = (); eval { ($script_name, $action) = _route_request($script_name); 1; } or return; @@ -139,14 +153,14 @@ sub handle_request { pre_request_checks(); eval { + $::form->error($::locale->text('System currently down for maintenance!')) if -e "$::userspath/nologin" && $script ne 'admin'; + if ($script eq 'login' or $script eq 'admin' or $script eq 'kopf') { $::form->{titlebar} = "Lx-Office " . $::locale->text('Version') . " $::form->{version}"; ::run($::auth->restore_session); } elsif ($action) { # copy from am.pl routines - $::form->error($::locale->text('System currently down for maintenance!')) if -e "$main::userspath/nologin" && $script ne 'admin'; - my $session_result = $::auth->restore_session; show_error('login/password_error', 'session') if SL::Auth::SESSION_EXPIRED == $session_result;