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 sets up the terminal and runs the scripts
28 # in bin/$terminal directory
29 # admin.pl is linked to this script
31 #######################################################################
33 # setup defaults, DO NOT CHANGE
35 $templates = "templates";
36 $memberfile = "users/members";
37 $sendmail = "| /usr/sbin/sendmail -t";
38 ########## end ###########################################
43 $lxdebug = LXDebug->new();
45 eval { require "lx-erp.conf"; };
47 if ($ENV{CONTENT_LENGTH}) {
48 read(STDIN, $_, $ENV{CONTENT_LENGTH});
51 if ($ENV{QUERY_STRING}) {
52 $_ = $ENV{QUERY_STRING};
61 # fix for apache 2.0 bug
62 map { $form{$_} =~ s/\\$// } keys %form;
66 $pos = rindex $0, '/';
67 $script = substr($0, $pos + 1);
69 if (-e "$userspath/nologin" && $script ne 'admin.pl') {
70 print "content-type: text/plain
77 require "bin/mozilla/installationcheck.pl";
78 verify_installation();
81 $form{path} =~ s/%2f/\//gi;
82 $form{path} =~ s/\.\.\///g;
84 if ($form{path} !~ /^bin\//) {
85 print "content-type: text/plain
91 $ARGV[0] = "$_&script=$script";
92 require "$form{path}/$script";
95 if (!$form{terminal}) {
96 if ($ENV{HTTP_USER_AGENT}) {
99 if ($ENV{HTTP_USER_AGENT} =~ /(mozilla|links|opera|w3m)/i) {
100 $form{terminal} = "mozilla";
104 if ($ENV{TERM} =~ /xterm/) {
105 $form{terminal} = "xterm";
107 if ($ENV{TERM} =~ /(console|linux|vt.*)/i) {
108 $form{terminal} = "console";
113 if ($form{terminal}) {
115 $ARGV[0] = "path=bin/$form{terminal}&script=$script";
116 map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
118 require "bin/$form{terminal}/$script";