X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDispatcher.pm;h=b4f75ba1bbd860d098acf54553db0d034fe21fa8;hb=d4f9d559a4a4d5e8fa2bb10be268e24634169b5e;hp=76d49b5f8070410a20d20069170ee7967d9cc17d;hpb=7a6044728948035cb42964d764c93038e88a914b;p=kivitendo-erp.git diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 76d49b5f8..b4f75ba1b 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -70,6 +70,7 @@ sub pre_startup_setup { $::userspath = "users"; $::templates = "templates"; $::memberfile = "users/members"; + $::menufile = "menu.ini"; $::sendmail = "| /usr/sbin/sendmail -t"; $::lxdebug = LXDebug->new; $::auth = SL::Auth->new; @@ -101,10 +102,10 @@ 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); } @@ -125,9 +126,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; @@ -206,18 +208,18 @@ sub _route_request { } sub _route_dispatcher_request { - my $action_re = '[a-z0-9_\-]+'; + my $name_re = qr{[a-z]\w*}; my ($script_name, $action); eval { - die "Unroutable request -- inavlid module name.\n" if !$::form->{M} || ($::form->{M} !~ m/^$action_re$/); + die "Unroutable request -- inavlid module name.\n" if !$::form->{M} || ($::form->{M} !~ m/^${name_re}$/); $script_name = $::form->{M} . '.pl'; if ($::form->{A}) { $action = $::form->{A}; } else { - $action = first { m/^A_${action_re}$/ } keys %{ $::form }; + $action = first { m/^A_${name_re}$/ } keys %{ $::form }; die "Unroutable request -- inavlid action name.\n" if !$action; delete $::form->{$action};