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 unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
35 push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version.
38 # setup defaults, DO NOT CHANGE
40 $templates = "templates";
41 $memberfile = "users/members";
42 $sendmail = "| /usr/sbin/sendmail -t";
43 ########## end ###########################################
48 $lxdebug = LXDebug->new();
50 use CGI qw( -no_xhtml);
54 eval { require "lx-erp.conf"; };
55 eval { require "lx-erp-local.conf"; } if -f "lx-erp-local.conf";
57 require "bin/mozilla/common.pl";
59 if (defined($latex) && !defined($latex_templates)) {
60 $latex_templates = $latex;
67 # this prevents most of the tabindexes being created by CGI.
68 # note: most. popup menus and selecttables will still have tabindexes
69 # use common.pl's NTI function to get rid of those
70 local $CGI::TABINDEX = 0;
74 $pos = rindex $0, '/';
75 $script = substr($0, $pos + 1);
77 # we use $script for the language module
78 $form->{script} = $script;
80 # strip .pl for translation files
86 $form->{login} =~ s|.*/||;
88 # check for user config file, could be missing or ???
89 eval { require("$userspath/$form->{login}.conf"); };
91 $locale = new Locale "$language", "$script";
93 $form->{callback} = "";
94 $msg1 = $locale->text('You are logged out!');
95 $msg2 = $locale->text('Login');
96 $form->redirect("$msg1 <p><a href=login.pl target=_top>$msg2</a>");
99 $myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
100 map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset)
101 unless (($form->{action} eq 'save') && ($form->{type} eq 'preferences'));
104 $locale = new Locale "$myconfig{countrycode}", "$script";
107 $form->error($locale->text('Incorrect Password!'))
108 if ($form->{password} ne $myconfig{password});
110 # did sysadmin lock us out
111 if (-e "$userspath/nologin") {
112 $form->error($locale->text('System currently down for maintenance!'));
115 # pull in the main code
116 require "bin/mozilla/$form->{script}";
119 if (-f "bin/mozilla/custom_$form->{script}") {
120 eval { require "bin/mozilla/custom_$form->{script}"; };
121 $form->error($@) if ($@);
124 # customized scripts for login
125 if (-f "bin/mozilla/$form->{login}_$form->{script}") {
126 eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
127 $form->error($@) if ($@);
130 if ($form->{action}) {
132 # window title bar, user info
135 . $locale->text('Version')
136 . " $form->{version} - $myconfig{name} - $myconfig{dbname}";
138 call_sub($locale->findsub($form->{action}));
140 $form->error($locale->text('action= not defined!'));