X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fadmin.pl;h=6d518fcbdef8f871a8388afa0c30b19dd7d46e46;hb=540030ff9826439d94f3f4292ab79b9be8795acc;hp=0829934c275ccd99eac0babf197c678e61de90f8;hpb=e848dbf1f17a606e22afb161cb3fb7bd88895f92;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index 0829934c2..6d518fcbd --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,806 +32,472 @@ # #====================================================================== -$menufile = "menu.ini"; - +use DBI; +use Encode; +use English qw(-no_match_vars); +use Fcntl; +use File::Copy; +use File::Find; +use File::Spec; +use Cwd; +use IO::File; +use POSIX qw(strftime); +use Sys::Hostname; + +use SL::Auth; +use SL::Auth::PasswordPolicy; use SL::Form; +use SL::Iconv; +use SL::Mailer; use SL::User; +use SL::Common; +use SL::Inifile; +use SL::DBUpgrade2; +use SL::DBUtils; -$form = new Form; - -$locale = new Locale $language, "admin"; - -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); - -# customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; - $form->error($@) if ($@); -} +require "bin/mozilla/common.pl"; +require "bin/mozilla/admin_groups.pl"; +require "bin/mozilla/admin_printer.pl"; -$form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; +use strict; -if ($form->{action}) { +# parserhappy(R): - $subroutine = $locale->findsub($form->{action}); +# $locale->text('periodic') +# $locale->text('income') +# $locale->text('perpetual') +# $locale->text('balance') - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; - } - } +our $cgi; +our $form; +our $locale; +our $auth; - &check_password; +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; - &$subroutine; + $form = $::form; + $locale = $::locale; + $auth = $::auth; -} else { + $::auth->store_root_credentials_in_session($form->{rpw}) if $session_result == SL::Auth->SESSION_OK; - # if there are no drivers bail out - $form->error($locale->text('No Database Drivers available!')) - unless (User->dbdrivers); + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; - # create memberfile - if (!-f $memberfile) { - open(FH, ">$memberfile") or $form->error("$memberfile : $!"); - print FH qq|# SQL-Ledger Accounting members + if ($form->{action}) { + if ($auth->authenticate_root($form->{rpw}) != $auth->OK()) { + $form->{error_message} = $locale->text('Incorrect Password!'); + $auth->delete_session_value('rpw'); + adminlogin(); + } else { + if ($auth->session_tables_present()) { + $::auth->store_root_credentials_in_session($::form->{rpw}); + delete $::form->{rpw}; + _apply_dbupgrade_scripts(); + } -[root login] -password= + call_sub($locale->findsub($form->{action})); + } + } else { + # if there are no drivers bail out + $form->error($locale->text('No Database Drivers available!')) + unless (User->dbdrivers); -|; - close FH; + adminlogin(); } - - &adminlogin; - + $::lxdebug->leave_sub; } -1; +sub adminlogin { + my $form = $main::form; + my $locale = $main::locale; -# end + $form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); -sub adminlogin { + $form->header(); + print $form->parse_html_template('admin/adminlogin'); +} - $form->{title} = - qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); +sub login { + check_auth_db_and_tables(); + list_users(); +} - $form->header; +sub logout { + $main::auth->destroy_session(); + adminlogin(); +} - print qq| -
+sub check_auth_db_and_tables { + my $form = $main::form; + my $locale = $main::locale; + my %params; -| - . $locale->text('Administration') - . qq| + if (!$main::auth->check_database()) { + $form->{title} = $locale->text('Authentification database creation'); + $form->header(); + print $form->parse_html_template('admin/check_auth_database', \%params); -
+ my $memberfile = $::lx_office_conf{paths}->{memberfile}; + if (-f $memberfile) { + my $memberdir = ""; -Lx-Office | - . $locale->text('website') . qq| + if ($memberfile =~ m|^.*/|) { + $memberdir = $&; + } -