X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/bd23cc3e64900f14317c147aa52a8b1a7633e2a4..a3ae31c:/bin/mozilla/admin.pl diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index a9769a06b..8d0e4426f --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,1268 +32,219 @@ # #====================================================================== -$menufile = "menu.ini"; - use DBI; -use CGI; - +use Encode; +use English qw(-no_match_vars); +use Fcntl; +use File::Copy; +use File::Find; +use File::Spec; +use Cwd; +use IO::Dir; +use IO::File; +use POSIX qw(strftime); +use Sys::Hostname; + +use SL::Auth; +use SL::Auth::PasswordPolicy; +use SL::DB::AuthClient; +use SL::DB::AuthUser; use SL::Form; +use SL::Iconv; +use SL::Mailer; use SL::User; use SL::Common; +use SL::Inifile; +use SL::DBUpgrade2; +use SL::DBUtils; +use SL::Template; require "bin/mozilla/common.pl"; -our $cgi = new CGI(''); - -$form = new Form; -$form->{"root"} = "root login"; - -$locale = new Locale $language, "admin"; - -# customization -if (-f "bin/mozilla/custom_$form->{script}") { - eval { require "bin/mozilla/custom_$form->{script}"; }; - $form->error($@) if ($@); -} - -$form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; - -if ($form->{action}) { - - - $subroutine = $locale->findsub($form->{action}); - - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; - } - } - - check_password(); - - call_sub($subroutine); - -} else { - - # if there are no drivers bail out - $form->error($locale->text('No Database Drivers available!')) - unless (User->dbdrivers); - - # create memberfile - if (!-f $memberfile) { - open(FH, ">$memberfile") or $form->error("$memberfile : $!"); - print FH qq|# SQL-Ledger Accounting members - -[root login] -password= - -|; - close FH; - } - - adminlogin(); - -} - -1; - -# end - -sub adminlogin { - - $form->{title} = - qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - - $form->header(); - print $form->parse_html_template('admin/adminlogin'); -} - -sub login { - list_users(); -} - -sub list_users { - - $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK"); - - open(FH, "$memberfile") or $form->error("$memberfile : $!"); - - my %members; - - while () { - chomp; - - if (/^\[.*\]/) { - $login = $_; - $login =~ s/(\[|\])//g; - - $members{$login} = { "login" => $login }; - } - - if (/^([a-z]+)=(.*)/) { - $members{$login}->{$1} = $2; - } - } - - close(FH); - - delete $members{"root login"}; - map { $_->{templates} =~ s|.*/||; } values %members; - - $form->{title} = "Lx-Office ERP " . $locale->text('Administration'); - $form->{LOCKED} = -e "$userspath/nologin"; - $form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ]; - - $form->header(); - print $form->parse_html_template("admin/list_users"); -} - -sub add_user { - - $form->{title} = - "Lx-Office ERP " - . $locale->text('Administration') . " / " - . $locale->text('Add User'); - - $form->{Oracle_sid} = $sid; - $form->{Oracle_dbport} = '1521'; - $form->{Oracle_dbhost} = `hostname`; - - if (-f "css/lx-office-erp.css") { - $myconfig->{stylesheet} = "lx-office-erp.css"; - } - - $myconfig->{vclimit} = 200; - $myconfig->{countrycode} = "de"; - $myconfig->{numberformat} = "1000,00"; - $myconfig->{dateformat} = "dd.mm.yy"; - - form_header(); - form_footer(); - -} - -sub edit { - - $form->{title} = - "Lx-Office ERP " - . $locale->text('Administration') . " / " - . $locale->text('Edit User'); - $form->{edit} = 1; - - form_header(); - form_footer(); - -} - -sub form_footer { - - if ($form->{edit}) { - $delete = - qq| -|; - } - - print qq| - - -{rpw}> - - -$delete - - - - - -|; - -} - -sub form_header { - - # if there is a login, get user - if ($form->{login}) { - - # get user - $myconfig = new User "$memberfile", "$form->{login}"; - - $myconfig->{signature} =~ s/\\n/\r\n/g; - $myconfig->{address} =~ s/\\n/\r\n/g; - - # strip basedir from templates directory - $myconfig->{templates} =~ s/^$templates\///; - - # $myconfig->{dbpasswd} = unpack 'u', $myconfig->{dbpasswd}; - } - - foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) { - $dateformat .= - ($item eq $myconfig->{dateformat}) - ? "