3 ######################################################################
4 # SQL-Ledger Accounting
7 # Author: Dieter Simader
8 # Email: dsimader@sql-ledger.org
9 # Web: http://www.sql-ledger.org
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #######################################################################
27 # this script is the frontend called from bin/$terminal/$script
28 # all the accounting modules are linked to this script which in
29 # turn execute the same script in bin/$terminal/
31 #######################################################################
34 push(@INC, "modules");
37 # setup defaults, DO NOT CHANGE
39 $templates = "templates";
40 $memberfile = "users/members";
41 $sendmail = "| /usr/sbin/sendmail -t";
42 ########## end ###########################################
47 $lxdebug = LXDebug->new();
53 eval { require "lx-erp.conf"; };
54 eval { require "lx-erp-local.conf"; } if -f "lx-erp-local.conf";
56 require "bin/mozilla/common.pl";
58 if (defined($latex) && !defined($latex_templates)) {
59 $latex_templates = $latex;
68 $pos = rindex $0, '/';
69 $script = substr($0, $pos + 1);
71 # we use $script for the language module
72 $form->{script} = $script;
74 # strip .pl for translation files
80 $form->{login} =~ s|.*/||;
82 # check for user config file, could be missing or ???
83 eval { require("$userspath/$form->{login}.conf"); };
85 $locale = new Locale "$language", "$script";
87 $form->{callback} = "";
88 $msg1 = $locale->text('You are logged out!');
89 $msg2 = $locale->text('Login');
90 $form->redirect("$msg1 <p><a href=login.pl target=_top>$msg2</a>");
93 $myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
94 map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset)
95 unless (($form->{action} eq 'save') && ($form->{type} eq 'preferences'));
98 $locale = new Locale "$myconfig{countrycode}", "$script";
101 $form->error($locale->text('Incorrect Password!'))
102 if ($form->{password} ne $myconfig{password});
104 # did sysadmin lock us out
105 if (-e "$userspath/nologin") {
106 $form->error($locale->text('System currently down for maintenance!'));
109 # pull in the main code
110 require "bin/mozilla/$form->{script}";
113 if (-f "bin/mozilla/custom_$form->{script}") {
114 eval { require "bin/mozilla/custom_$form->{script}"; };
115 $form->error($@) if ($@);
118 # customized scripts for login
119 if (-f "bin/mozilla/$form->{login}_$form->{script}") {
120 eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
121 $form->error($@) if ($@);
124 if ($form->{action}) {
126 # window title bar, user info
129 . $locale->text('Version')
130 . " $form->{version} - $myconfig{name} - $myconfig{dbname}";
132 call_sub($locale->findsub($form->{action}));
134 $form->error($locale->text('action= not defined!'));