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/YAML"; # Use our own version of YAML.
 
  35   push @INC, "modules";         # 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();
 
  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;
 
  69 $pos = rindex $0, '/';
 
  70 $script = substr($0, $pos + 1);
 
  72 # we use $script for the language module
 
  73 $form->{script} = $script;
 
  75 # strip .pl for translation files
 
  81 $form->{login} =~ s|.*/||;
 
  83 # check for user config file, could be missing or ???
 
  84 eval { require("$userspath/$form->{login}.conf"); };
 
  86   $locale = new Locale "$language", "$script";
 
  88   $form->{callback} = "";
 
  89   $msg1             = $locale->text('You are logged out!');
 
  90   $msg2             = $locale->text('Login');
 
  91   $form->redirect("$msg1 <p><a href=login.pl target=_top>$msg2</a>");
 
  94 $myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
 
  95 map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset)
 
  96   unless (($form->{action} eq 'save') && ($form->{type} eq 'preferences'));
 
  99 $locale = new Locale "$myconfig{countrycode}", "$script";
 
 102 $form->error($locale->text('Incorrect Password!'))
 
 103   if ($form->{password} ne $myconfig{password});
 
 105 # did sysadmin lock us out
 
 106 if (-e "$userspath/nologin") {
 
 107   $form->error($locale->text('System currently down for maintenance!'));
 
 110 # pull in the main code
 
 111 require "bin/mozilla/$form->{script}";
 
 114 if (-f "bin/mozilla/custom_$form->{script}") {
 
 115   eval { require "bin/mozilla/custom_$form->{script}"; };
 
 116   $form->error($@) if ($@);
 
 119 # customized scripts for login
 
 120 if (-f "bin/mozilla/$form->{login}_$form->{script}") {
 
 121   eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
 
 122   $form->error($@) if ($@);
 
 125 if ($form->{action}) {
 
 127   # window title bar, user info
 
 130     . $locale->text('Version')
 
 131     . " $form->{version} - $myconfig{name} - $myconfig{dbname}";
 
 133   call_sub($locale->findsub($form->{action}));
 
 135   $form->error($locale->text('action= not defined!'));