#
#======================================================================
-my $menufile = "menu.ini";
-
use DBI;
use CGI;
use English qw(-no_match_vars);
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;
$form->header();
print $form->parse_html_template('admin/check_auth_database', \%params);
- exit 0;
+ ::end_of_request();
}
if (!$main::auth->check_tables()) {
$form->header();
print $form->parse_html_template('admin/check_auth_tables', \%params);
- exit 0;
+ ::end_of_request();
}
if (-f $main::memberfile) {
print $form->parse_html_template('admin/user_migration', { 'memberfile' => $main::memberfile,
'backupdir' => $backupdir });
- exit 0
+ ::end_of_request();
}
}
$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 (<HTACCESS>) {
- ($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 (<HTACCESS>) {
- ($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|.*/||;