From c3c9871298597e417d67f691fca24cd913ef802a Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 24 Oct 2006 00:01:16 +0000 Subject: Moved all scalars out of ledger-smb.conf git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@268 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/AA.pm | 10 +++---- LedgerSMB/AM.pm | 24 ++++++++-------- LedgerSMB/BP.pm | 10 +++---- LedgerSMB/CP.pm | 6 ++-- LedgerSMB/Form.pm | 14 +++++----- LedgerSMB/IR.pm | 10 +++---- LedgerSMB/IS.pm | 12 ++++---- LedgerSMB/JC.pm | 10 +++---- LedgerSMB/Log.pm | 2 +- LedgerSMB/OE.pm | 12 ++++---- LedgerSMB/Session.pm | 6 ++-- LedgerSMB/Sysconfig.pm | 40 ++++++++++++++++++++++++++- LedgerSMB/User.pm | 16 +++++------ admin.pl | 2 +- bin/aa.pl | 8 +++--- bin/admin.pl | 74 +++++++++++++++++++++++++------------------------- bin/am.pl | 14 +++++----- bin/arap.pl | 2 +- bin/arapprn.pl | 18 ++++++------ bin/bp.pl | 12 ++++---- bin/cp.pl | 14 +++++----- bin/hr.pl | 4 +-- bin/io.pl | 16 +++++------ bin/is.pl | 6 ++-- bin/jc.pl | 18 ++++++------ bin/login.pl | 12 ++++---- bin/oe.pl | 6 ++-- bin/pe.pl | 2 +- bin/pos.pl | 4 +-- bin/rp.pl | 10 +++---- ledger-smb.conf | 39 -------------------------- login.pl | 2 +- menu.pl | 2 +- 33 files changed, 218 insertions(+), 219 deletions(-) diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm index bf6c7224..8772a59a 100755 --- a/LedgerSMB/AA.pm +++ b/LedgerSMB/AA.pm @@ -595,11 +595,11 @@ sub delete_transaction { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query); - my $spoolfile; + my ${LedgerSMB::Sysconfig::spool}file; my @spoolfiles = (); - while (($spoolfile) = $sth->fetchrow_array) { - push @spoolfiles, $spoolfile; + while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) { + push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file; } $sth->finish; @@ -611,8 +611,8 @@ sub delete_transaction { my $rc = $dbh->commit; if ($rc) { - foreach $spoolfile (@spoolfiles) { - unlink "$spool/$spoolfile" if $spoolfile; + foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) { + unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile; } } diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm index 57c75cb3..63c7e0b5 100755 --- a/LedgerSMB/AM.pm +++ b/LedgerSMB/AM.pm @@ -1238,9 +1238,9 @@ sub check_template_name { if ($form->{file} =~ /^(.:)*?\/|\.\.\/|^\//){ $form->error("Directory transversal not allowed."); } - my $userspath = ${main::userspath}; - if ($form->{file} =~ /^$userspath\//){ - $form->error("Not allowed to access $userspath/ with this method"); + my ${LedgerSMB::Sysconfig::userspath} = ${main::userspath}; + if ($form->{file} =~ /^${LedgerSMB::Sysconfig::userspath}\//){ + $form->error("Not allowed to access ${LedgerSMB::Sysconfig::userspath}/ with this method"); } my $whitelisted = 0; for (@allowedsuff){ @@ -1292,7 +1292,7 @@ sub save_template { sub save_preferences { - my ($self, $myconfig, $form, $memberfile, $userspath) = @_; + my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}) = @_; # connect to database my $dbh = $form->{dbh}; @@ -1317,7 +1317,7 @@ sub save_preferences { $dbh->commit; - my $myconfig = new User "$memberfile", "$form->{login}"; + my $myconfig = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}"; foreach my $item (keys %$form) { $myconfig->{$item} = $form->{$item}; @@ -1325,7 +1325,7 @@ sub save_preferences { $myconfig->{password} = $form->{new_password} if ($form->{old_password} ne $form->{new_password}); - $myconfig->save_member($memberfile, $userspath); + $myconfig->save_member(${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}); 1; @@ -1565,7 +1565,7 @@ sub save_taxes { sub backup { - my ($self, $myconfig, $form, $userspath, $gzip) = @_; + my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::userspath}, ${LedgerSMB::Sysconfig::gzip}) = @_; my $mail; my $err; @@ -1577,7 +1577,7 @@ sub backup { $t[4] = substr("0$t[4]", -2); my $boundary = time; - my $tmpfile = "$userspath/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql"; + my $tmpfile = "${LedgerSMB::Sysconfig::userspath}/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql"; my $out = $form->{OUT}; $form->{OUT} = ">$tmpfile"; @@ -1596,8 +1596,8 @@ sub backup { my $suffix = ""; if ($form->{media} eq 'email') { - if ($gzip){ - print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | $gzip`; + if (${LedgerSMB::Sysconfig::gzip}){ + print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | ${LedgerSMB::Sysconfig::gzip}`; } else { print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname}`; } @@ -1625,8 +1625,8 @@ sub backup { print OUT qq|Content-Type: application/file;\n| . qq|Content-Disposition: attachment; filename="$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix"\n\n|; - if ($gzip){ - print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | $gzip`; + if (${LedgerSMB::Sysconfig::gzip}){ + print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | ${LedgerSMB::Sysconfig::gzip}`; } else { print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname}`; } diff --git a/LedgerSMB/BP.pm b/LedgerSMB/BP.pm index 3821cd87..d902be91 100755 --- a/LedgerSMB/BP.pm +++ b/LedgerSMB/BP.pm @@ -242,7 +242,7 @@ sub get_spoolfiles { sub delete_spool { - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_; # connect to database, turn AutoCommit off my $dbh = $form->dbconnect_noauto($myconfig); @@ -278,7 +278,7 @@ sub delete_spool { if ($rc) { foreach my $i (1 .. $form->{rowcount}) { - $_ = qq|$spool/$form->{"spoolfile_$i"}|; + $_ = qq|${LedgerSMB::Sysconfig::spool}/$form->{"spoolfile_$i"}|; if ($form->{"checked_$i"}) { unlink; } @@ -291,7 +291,7 @@ sub delete_spool { sub print_spool { - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); @@ -310,10 +310,10 @@ sub print_spool { open(OUT, $form->{OUT}) or $form->error("$form->{OUT} : $!"); binmode(OUT); - $spoolfile = qq|$spool/$form->{"spoolfile_$i"}|; + ${LedgerSMB::Sysconfig::spool}file = qq|$spool/$form->{"spoolfile_$i"}|; # send file to printer - open(IN, $spoolfile) or $form->error("$spoolfile : $!"); + open(IN, ${LedgerSMB::Sysconfig::spool}file) or $form->error("$spoolfile : $!"); binmode(IN); while () { diff --git a/LedgerSMB/CP.pm b/LedgerSMB/CP.pm index 9db05ce6..f3ff50fa 100755 --- a/LedgerSMB/CP.pm +++ b/LedgerSMB/CP.pm @@ -266,7 +266,7 @@ sub get_openinvoices { my $vth = $dbh->prepare($query); - my $spoolfile; + my ${LedgerSMB::Sysconfig::spool}file; while ($ref = $sth->fetchrow_hashref(NAME_lc)) { @@ -276,8 +276,8 @@ sub get_openinvoices { $vth->execute($ref->{id}); $ref->{queue} = ""; - while (($spoolfile) = $vth->fetchrow_array) { - $ref->{queued} .= "$form->{formname} $spoolfile "; + while ((${LedgerSMB::Sysconfig::spool}file) = $vth->fetchrow_array) { + $ref->{queued} .= "$form->{formname} ${LedgerSMB::Sysconfig::spool}file "; } $vth->finish; diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index b42f68bb..6f4ee35e 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -570,7 +570,7 @@ sub get_my_emp_num { sub parse_template { - my ($self, $myconfig, $userspath) = @_; + my ($self, $myconfig, ${LedgerSMB::Sysconfig::userspath}) = @_; my ($chars_per_line, $lines_on_first_page, $lines_on_second_page) = (0, 0, 0); my ($current_page, $current_line) = (1, 1); @@ -605,7 +605,7 @@ sub parse_template { my $fileid = time; my $tmpfile = $self->{IN}; $tmpfile =~ s/\./_$self->{fileid}./ if $self->{fileid}; - $self->{tmpfile} = "$userspath/${fileid}_${tmpfile}"; + $self->{tmpfile} = "${LedgerSMB::Sysconfig::userspath}/${fileid}_${tmpfile}"; if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') { $out = $self->{OUT}; @@ -822,15 +822,15 @@ sub parse_template { use Cwd; $self->{cwd} = cwd(); - $self->{tmpdir} = "$self->{cwd}/$userspath"; + $self->{tmpdir} = "$self->{cwd}/${LedgerSMB::Sysconfig::userspath}"; - unless (chdir("$userspath")) { + unless (chdir("${LedgerSMB::Sysconfig::userspath}")) { $err = $!; $self->cleanup; $self->error("chdir : $err"); } - $self->{tmpfile} =~ s/$userspath\///g; + $self->{tmpfile} =~ s/${LedgerSMB::Sysconfig::userspath}\///g; $self->{errfile} = $self->{tmpfile}; $self->{errfile} =~ s/tex$/err/; @@ -2407,7 +2407,7 @@ sub update_status { my $dbh = $self->{dbh}; my %queued = split / +/, $self->{queued}; - my $spoolfile = ($queued{$self->{formname}}) ? "'$queued{$self->{formname}}'" : 'NULL'; + my ${LedgerSMB::Sysconfig::spool}file = ($queued{$self->{formname}}) ? "'$queued{$self->{formname}}'" : 'NULL'; my $query = qq|DELETE FROM status WHERE formname = ? @@ -2427,7 +2427,7 @@ sub update_status { VALUES (?, ?, ?, ?, ?)|; $sth = $dbh->prepare($query); - $sth->execute($self->{id}, $printed, $emailed, $spoolfile, + $sth->execute($self->{id}, $printed, $emailed, ${LedgerSMB::Sysconfig::spool}file, $self->{formname}); $sth->finish; diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm index 9f2da830..d2703958 100755 --- a/LedgerSMB/IR.pm +++ b/LedgerSMB/IR.pm @@ -703,11 +703,11 @@ sub delete_invoice { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - my $spoolfile; + my ${LedgerSMB::Sysconfig::spool}file; my @spoolfiles = (); - while (($spoolfile) = $sth->fetchrow_array) { - push @spoolfiles, $spoolfile; + while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) { + push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file; } $sth->finish; @@ -728,8 +728,8 @@ sub delete_invoice { $dbh->commit; } - foreach $spoolfile (@spoolfiles) { - unlink "$spool/$spoolfile" if $spoolfile; + foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) { + unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile; } } diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm index 0b38b3a8..96aafdac 100755 --- a/LedgerSMB/IS.pm +++ b/LedgerSMB/IS.pm @@ -1224,7 +1224,7 @@ sub reverse_invoice { sub delete_invoice { - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); @@ -1251,11 +1251,11 @@ sub delete_invoice { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - my $spoolfile; + my ${LedgerSMB::Sysconfig::spool}file; my @spoolfiles = (); - while (($spoolfile) = $sth->fetchrow_array) { - push @spoolfiles, $spoolfile; + while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) { + push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file; } $sth->finish; @@ -1267,8 +1267,8 @@ sub delete_invoice { my $rc = $dbh->commit; if ($rc) { - foreach $spoolfile (@spoolfiles) { - unlink "$spool/$spoolfile" if $spoolfile; + foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) { + unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile; } } diff --git a/LedgerSMB/JC.pm b/LedgerSMB/JC.pm index 02fcb914..37ed40d1 100755 --- a/LedgerSMB/JC.pm +++ b/LedgerSMB/JC.pm @@ -308,11 +308,11 @@ sub delete_timecard { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - my $spoolfile; + my ${LedgerSMB::Sysconfig::spool}file; my @spoolfiles = (); - while (($spoolfile) = $sth->fetchrow_array) { - push @spoolfiles, $spoolfile; + while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) { + push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file; } $sth->finish; @@ -325,8 +325,8 @@ sub delete_timecard { my $rc = $dbh->commit; if ($rc) { - foreach $spoolfile (@spoolfiles) { - unlink "$spool/$spoolfile" if $spoolfile; + foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) { + unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile; } } diff --git a/LedgerSMB/Log.pm b/LedgerSMB/Log.pm index 954a1a6b..235a2ded 100644 --- a/LedgerSMB/Log.pm +++ b/LedgerSMB/Log.pm @@ -46,7 +46,7 @@ use LedgerSMB::Sysconfig; our $fh; sub print { - if (!$LSMBConfig::logging){ + if (!$LedgerSMB::Sysconfig::logging){ return 0; } shift; diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm index 0d9ab99d..0dfd2937 100755 --- a/LedgerSMB/OE.pm +++ b/LedgerSMB/OE.pm @@ -665,7 +665,7 @@ sub save { sub delete { - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_; # connect to database my $dbh = $form->{dbh}; @@ -678,11 +678,11 @@ sub delete { $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query); - my $spoolfile; + my ${LedgerSMB::Sysconfig::spool}file; my @spoolfiles = (); - while (($spoolfile) = $sth->fetchrow_array) { - push @spoolfiles, $spoolfile; + while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) { + push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file; } $sth->finish; @@ -751,8 +751,8 @@ sub delete { $dbh->disconnect; if ($rc) { - foreach $spoolfile (@spoolfiles) { - unlink "$spool/$spoolfile" if $spoolfile; + foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) { + unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile; } } diff --git a/LedgerSMB/Session.pm b/LedgerSMB/Session.pm index 39de16e6..76ed27ce 100755 --- a/LedgerSMB/Session.pm +++ b/LedgerSMB/Session.pm @@ -16,8 +16,8 @@ package Session; use LedgerSMB::Sysconfig; -if (!${LSMBConfig::session}){ - ${LSMBConfig::session} = 'DB'; +if (!${LedgerSMB::Sysconfig::session}){ + ${LedgerSMB::Sysconfig::session} = 'DB'; } -require "LedgerSMB/Session/".${LSMBConfig::session}.".pm"; +require "LedgerSMB/Session/".${LedgerSMB::Sysconfig::session}.".pm"; diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm index 7d0f56fe..aaab3319 100644 --- a/LedgerSMB/Sysconfig.pm +++ b/LedgerSMB/Sysconfig.pm @@ -2,12 +2,50 @@ # configuration directives will go here, This will probably not fully replace # the ledger-smb.conf until 1.3, however. -package LSMBConfig; +package LedgerSMB::Sysconfig; $session='DB'; $logging=0; # No logging on by default @io_lineitem_columns = qw(unit onhand sellprice discount linetotal); +# if you have latex installed set to 1 +$latex = 1; + +# spool directory for batch printing +$spool = "spool"; + +# path to user configuration files +$userspath = "users"; + +# templates base directory +$templates = "templates"; + +# member file +$memberfile = "users/members"; + +# location of sendmail +$sendmail = "| /usr/sbin/sendmail -t"; + +# set language for login and admin +$language = ""; + +# Maximum number of invoices that can be printed on a check +$check_max_invoices = 5; + +# program to use for file compression +$gzip = "gzip -S .gz"; + +################################# +# Global database parameters +################################# +# These parameters *must* be set correctly +# for LedgerSMB >= 1.2 to work +my $globalDBConnect = 'dbi:Pg:dbname=ledgersmb;host=localhost;port=5432'; +my $globalUserName = "ledgersmb"; +my $globalPassword = "set me to correct password"; + +#$GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword); + 1; diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm index 7f3549c0..52516885 100755 --- a/LedgerSMB/User.pm +++ b/LedgerSMB/User.pm @@ -98,7 +98,7 @@ sub country_codes { sub login { - my ($self, $form, $userspath) = @_; + my ($self, $form, ${LedgerSMB::Sysconfig::userspath}) = @_; my $rc = -1; @@ -112,9 +112,9 @@ sub login { } #there shouldn't be any harm in always doing this. It might even un-bork things. - $self->create_config("$userspath/$self->{login}.conf"); + $self->create_config("${LedgerSMB::Sysconfig::userspath}/$self->{login}.conf"); - do "$userspath/$self->{login}.conf"; + do "${LedgerSMB::Sysconfig::userspath}/$self->{login}.conf"; $myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd}; # check if database is down @@ -752,18 +752,18 @@ sub create_config { sub save_member { - my ($self, $memberfile, $userspath) = @_; + my ($self, ${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}) = @_; # format dbconnect and dboptions string &dbconnect_vars($self, $self->{dbname}); - $self->error("$memberfile locked!") if (-f "${memberfile}.LCK"); + $self->error("${LedgerSMB::Sysconfig::memberfile} locked!") if (-f "${memberfile}.LCK"); open(FH, ">${memberfile}.LCK") or $self->error("${memberfile}.LCK : $!"); close(FH); - if (! open(CONF, "+<$memberfile")) { + if (! open(CONF, "+<${LedgerSMB::Sysconfig::memberfile}")) { unlink "${memberfile}.LCK"; - $self->error("$memberfile : $!"); + $self->error("${LedgerSMB::Sysconfig::memberfile} : $!"); } @config = ; @@ -819,7 +819,7 @@ sub save_member { # create conf file if (! $self->{'root login'}) { - $self->create_config("$userspath/$self->{login}.conf"); + $self->create_config("${LedgerSMB::Sysconfig::userspath}/$self->{login}.conf"); $self->{dbpasswd} =~ s/\\'/'/g; $self->{dbpasswd} =~ s/\\\\/\\/g; diff --git a/admin.pl b/admin.pl index 7f83eb74..5c9db43d 100755 --- a/admin.pl +++ b/admin.pl @@ -52,7 +52,7 @@ # setup defaults, DO NOT CHANGE $userspath = "users"; $spool = "spool"; -$templates = "templates"; +${LedgerSMB::Sysconfig::templates} = "templates"; $memberfile = "users/members"; $sendmail = "| /usr/sbin/sendmail -t"; %printer = ( Printer => 'lpr' ); diff --git a/bin/aa.pl b/bin/aa.pl index c6e32fed..e173f678 100755 --- a/bin/aa.pl +++ b/bin/aa.pl @@ -132,7 +132,7 @@ sub create_links { $form->{selectformname} = qq|\n$countrycodes|; # is there a templates basedir - if (! -d "$templates") { - $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist')); + if (! -d "${LedgerSMB::Sysconfig::templates}") { + $form->error($locale->text('Directory').": ${LedgerSMB::Sysconfig::templates} ".$locale->text('does not exist')); } - opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!"); + opendir TEMPLATEDIR, "${LedgerSMB::Sysconfig::templates}/." or $form->error("$templates : $!"); @all = grep !/^\.\.?$/, readdir TEMPLATEDIR; closedir TEMPLATEDIR; @@ -417,7 +417,7 @@ sub form_header { @alldir = (); for (@all) { - if (-d "$templates/$_") { + if (-d "${LedgerSMB::Sysconfig::templates}/$_") { push @alldir, $_; } } @@ -464,7 +464,7 @@ sub form_header { $selectstylesheet .= "\n"; - if (%printer && $latex) { + if (%printer && ${LedgerSMB::Sysconfig::latex}) { $selectprinter = "\n"; @@ -770,7 +770,7 @@ sub save { # check for duplicates if (!$form->{edit}) { - $temp = new User "$memberfile", "$form->{login}"; + $temp = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}"; if ($temp->{login}) { $form->error("$form->{login} ".$locale->text('is already a member!')); @@ -787,15 +787,15 @@ sub save { } # is there a basedir - if (! -d "$templates") { - $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist')); + if (! -d "${LedgerSMB::Sysconfig::templates}") { + $form->error($locale->text('Directory').": ${LedgerSMB::Sysconfig::templates} ".$locale->text('does not exist')); } # add base directory to $form->{templates} - $form->{templates} = "$templates/$form->{templates}"; + $form->{templates} = "${LedgerSMB::Sysconfig::templates}/$form->{templates}"; - $myconfig = new User "$memberfile", "$form->{login}"; + $myconfig = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}"; # redo acs variable and delete all the acs codes @acs = split /;/, $form->{acs}; @@ -838,7 +838,7 @@ sub save { $myconfig->{packpw} = 1; - $myconfig->save_member($memberfile, $userspath); + $myconfig->save_member(${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}); # create user template directory and copy master files if (! -d "$form->{templates}") { @@ -849,13 +849,13 @@ sub save { umask(007); # copy templates to the directory - opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!"); + opendir TEMPLATEDIR, "${LedgerSMB::Sysconfig::templates}/." or $form->error("$templates : $!"); @templates = grep /$form->{mastertemplates}-/, readdir TEMPLATEDIR; closedir TEMPLATEDIR; foreach $file (@templates) { - open(TEMP, "$templates/$file") or $form->error("$templates/$file : $!"); + open(TEMP, "${LedgerSMB::Sysconfig::templates}/$file") or $form->error("$templates/$file : $!"); $file =~ s/$form->{mastertemplates}-//; open(NEW, ">$form->{templates}/$file") or $form->error("$form->{templates}/$file : $!"); @@ -879,16 +879,16 @@ sub save { sub delete { - $form->{templates} = ($form->{templates}) ? "$templates/$form->{templates}" : "$templates/$form->{login}"; + $form->{templates} = ($form->{templates}) ? "${LedgerSMB::Sysconfig::templates}/$form->{templates}" : "$templates/$form->{login}"; - $form->error("$memberfile ".$locale->text('locked!')) if (-f ${memberfile}.LCK); + $form->error("${LedgerSMB::Sysconfig::memberfile} ".$locale->text('locked!')) if (-f ${memberfile}.LCK); open(FH, ">${memberfile}.LCK") or $form->error("${memberfile}.LCK : $!"); close(FH); - if (! open(CONF, "+<$memberfile")) { + if (! open(CONF, "+<${LedgerSMB::Sysconfig::memberfile}")) { unlink "${memberfile}.LCK"; - $form->error("$memberfile : $!"); + $form->error("${LedgerSMB::Sysconfig::memberfile} : $!"); } @config = ; @@ -972,7 +972,7 @@ sub delete { User->delete_login(\%$form); # delete config file for user - unlink "$userspath/$form->{login}.conf"; + unlink "${LedgerSMB::Sysconfig::userspath}/$form->{login}.conf"; } $form->redirect($locale->text('User deleted!')); @@ -1035,7 +1035,7 @@ sub change_password { $form->error($locale->text('Passwords do not match!')) if $form->{new_password} ne $form->{confirm_password}; $root->{password} = $form->{new_password}; $root->{'root login'} = 1; - $root->save_member($memberfile); + $root->save_member(${LedgerSMB::Sysconfig::memberfile}); $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}"; $form->redirect($locale->text('Password changed!')); } @@ -1048,7 +1048,7 @@ sub get_hash { sub check_password { - $root = new User "$memberfile", "root login"; + $root = new User "${LedgerSMB::Sysconfig::memberfile}", "root login"; if ($root->{password}) { @@ -1064,7 +1064,7 @@ sub check_password { &get_hash; - open(HASHFILE, "> $userspath/adminhash") || $form->error("Can't Open Hashfile: $!"); + open(HASHFILE, "> ${LedgerSMB::Sysconfig::userspath}/adminhash") || $form->error("Can't Open Hashfile: $!"); print HASHFILE $form->{hash}; print qq|Set-Cookie: LedgerSMB=$form->{hash}; path=/;\n|; @@ -1077,14 +1077,14 @@ sub check_password { $cookie = ($form->{path} eq 'bin/lynx') ? $cookie{login} : $cookie{"LedgerSMB-root login"}; #fixes problem with first login and such - if (!(-f "$userspath/adminhash")) { + if (!(-f "${LedgerSMB::Sysconfig::userspath}/adminhash")) { &get_hash; - open(HASHFILE, "> $userspath/adminhash") || $form->error("Can't Open Hashfile: $!"); + open(HASHFILE, "> ${LedgerSMB::Sysconfig::userspath}/adminhash") || $form->error("Can't Open Hashfile: $!"); print HASHFILE $form->{hash}; close(HASHFILE); } - open (HASHFILE, "< $userspath/adminhash") || $form->error("Can't Open Hashfile: $!"); + open (HASHFILE, "< ${LedgerSMB::Sysconfig::userspath}/adminhash") || $form->error("Can't Open Hashfile: $!"); chomp($form->{hash} = ); %cookies = split /[=;]/, $ENV{HTTP_COOKIE}; @@ -1372,7 +1372,7 @@ sub dbcreate { sub delete_dataset { - if (@dbsources = User->dbsources_unused(\%$form, $memberfile)) { + if (@dbsources = User->dbsources_unused(\%$form, ${LedgerSMB::Sysconfig::memberfile})) { foreach $item (sort @dbsources) { $dbsources .= qq| $item |; @@ -1463,7 +1463,7 @@ sub dbdelete { sub unlock_system { - unlink "$userspath/nologin"; + unlink "${LedgerSMB::Sysconfig::userspath}/nologin"; $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}"; $form->redirect($locale->text('Lockfile removed!')); } @@ -1471,7 +1471,7 @@ sub unlock_system { sub lock_system { - open(FH, ">$userspath/nologin") or $form->error($locale->text('Cannot create Lock!')); + open(FH, ">${LedgerSMB::Sysconfig::userspath}/nologin") or $form->error($locale->text('Cannot create Lock!')); close(FH); $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}"; $form->redirect($locale->text('Lockfile created!')); diff --git a/bin/am.pl b/bin/am.pl index cdc5959e..f51e029b 100755 --- a/bin/am.pl +++ b/bin/am.pl @@ -2064,7 +2064,7 @@ sub config { } $selectstylesheet .= "