X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/44b3c39cbbc125b7e8fb2170c2b621c8ea311b29..ec409dd12d7099de2dfd8854a1716cf044bdb25c:/bin/mozilla/admin.pl diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 46f16d790..e13411976 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,8 +32,6 @@ # #====================================================================== -my $menufile = "menu.ini"; - use DBI; use CGI; use English qw(-no_match_vars); @@ -57,56 +55,48 @@ require "bin/mozilla/admin_groups.pl"; use strict; -our $cgi = new CGI(''); -our $form = new Form; -our $locale = new Locale $main::language, "admin"; -our $auth = SL::Auth->new(); - -if ($auth->session_tables_present()) { - $auth->expire_sessions(); - $auth->restore_session(); - $auth->set_session_value('rpw', $form->{rpw}); -} +our $cgi; +our $form; +our $locale; +our $auth; -# customization -if (-f "bin/mozilla/custom_$form->{script}") { - eval { require "bin/mozilla/custom_$form->{script}"; }; - $form->error($@) if ($@); -} +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; -$form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; - -if ($form->{action}) { - if ($auth->authenticate_root($form->{rpw}, 0) != Auth->OK()) { - $form->{error_message} = $locale->text('Incorrect Password!'); - adminlogin(); - exit; - } + $cgi = $::cgi; + $form = $::form; + $locale = $::locale; + $auth = $::auth; - $auth->create_or_refresh_session() if ($auth->session_tables_present()); + $::auth->set_session_value('rpw', $::form->{rpw}) if $session_result == SL::Auth->SESSION_OK; - call_sub($locale->findsub($form->{action})); - -} elsif ($auth->authenticate_root($form->{rpw}, 0) == Auth->OK()) { - - $auth->create_or_refresh_session() if ($auth->session_tables_present()); + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; - login(); + if ($form->{action}) { + if ($auth->authenticate_root($form->{rpw}, 0) != $auth->OK()) { + $form->{error_message} = $locale->text('Incorrect Password!'); + adminlogin(); + } else { + $auth->create_or_refresh_session() if ($auth->session_tables_present()); + call_sub($locale->findsub($form->{action})); + } + } elsif ($auth->authenticate_root($form->{rpw}, 0) == $auth->OK()) { -} else { - # if there are no drivers bail out - $form->error($locale->text('No Database Drivers available!')) - unless (User->dbdrivers); + $auth->create_or_refresh_session() if ($auth->session_tables_present()); - adminlogin(); + login(); + } else { + # if there are no drivers bail out + $form->error($locale->text('No Database Drivers available!')) + unless (User->dbdrivers); + adminlogin(); + } + $::lxdebug->leave_sub; } -1; - -# end - sub adminlogin { my $form = $main::form; my $locale = $main::locale; @@ -140,7 +130,7 @@ sub check_auth_db_and_tables { $form->header(); print $form->parse_html_template('admin/check_auth_database', \%params); - exit 0; + ::end_of_request(); } if (!$main::auth->check_tables()) { @@ -148,7 +138,7 @@ sub check_auth_db_and_tables { $form->header(); print $form->parse_html_template('admin/check_auth_tables', \%params); - exit 0; + ::end_of_request(); } if (-f $main::memberfile) { @@ -165,7 +155,7 @@ sub check_auth_db_and_tables { print $form->parse_html_template('admin/user_migration', { 'memberfile' => $main::memberfile, 'backupdir' => $backupdir }); - exit 0 + ::end_of_request(); } } @@ -536,44 +526,6 @@ sub save_user { $main::auth->change_password($form->{login}, $form->{new_password}); } - my ($login, $password, $newfile); - if ($main::webdav) { - my @webdavdirs = - qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen); - foreach my $directory (@webdavdirs) { - my $file = "webdav/" . $directory . "/webdav-user"; - if ($form->{$directory}) { - if (open(HTACCESS, "$file")) { - while () { - ($login, $password) = split(/:/, $_); - if ($login ne $form->{login}) { - $newfile .= $_; - } - } - close(HTACCESS); - } - open(HTACCESS, "> $file") or die "cannot open $file $ERRNO\n"; - $newfile .= $myconfig->{login} . ":" . $myconfig->{password} . "\n"; - print(HTACCESS $newfile); - close(HTACCESS); - } else { - $form->{$directory} = 0; - if (open(HTACCESS, "$file")) { - while () { - ($login, $password) = split(/:/, $_); - if ($login ne $form->{login}) { - $newfile .= $_; - } - } - close(HTACCESS); - } - open(HTACCESS, "> $file") or die "cannot open $file $ERRNO\n"; - print(HTACCESS $newfile); - close(HTACCESS); - } - } - } - $form->{templates} =~ s|.*/||; $form->{templates} = "$main::templates/$form->{templates}"; $form->{mastertemplates} =~ s|.*/||;