summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-26 19:02:03 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-26 19:02:03 +0000
commit78d2ecf7d8ee85d943f26a0df35a7c40e3ecb913 (patch)
tree145857243ed85adac2e8c2b4d43203c86db8a0a4
parent8dd3af0e1497f938bee47da502b0e697f52eb198 (diff)
Fixing ordering issue for LedgerSMB.pm
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1331 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB.pm2
-rwxr-xr-xLedgerSMB/Session/DB.pm3
-rwxr-xr-xam.pl2
-rwxr-xr-xap.pl2
-rwxr-xr-xar.pl2
-rwxr-xr-xbp.pl2
-rwxr-xr-xca.pl2
-rwxr-xr-xcp.pl2
-rw-r--r--css/scripts/login.css2
-rwxr-xr-xct.pl2
-rwxr-xr-xemployee.pl2
-rwxr-xr-xgl.pl2
-rwxr-xr-xhr.pl2
-rwxr-xr-xic.pl2
-rwxr-xr-xir.pl2
-rwxr-xr-xis.pl2
-rwxr-xr-xjc.pl2
-rwxr-xr-xlocation.pl2
-rw-r--r--lsmb-request.pl2
-rwxr-xr-xmenu.pl205
-rwxr-xr-xoe.pl2
-rwxr-xr-xold-handler.pl206
-rwxr-xr-xpe.pl2
-rwxr-xr-xps.pl2
-rwxr-xr-xrc.pl2
-rwxr-xr-xrp.pl2
-rw-r--r--scripts/login.pl24
27 files changed, 233 insertions, 251 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index ac5c8e29..022caeb3 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -164,13 +164,13 @@ sub new {
#this is an ugly hack we need to rethink.
return $self;
}
+ $self->{_user} = LedgerSMB::User->fetch_config($self->{login});
my $locale = LedgerSMB::Locale->get_handle($self->{_user}->{countrycode})
or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
if ( !${LedgerSMB::Sysconfig::GLOBALDBH} ) {
$locale->text("No GlobalDBH Configured or Could not Connect");
}
- $self->{_user} = LedgerSMB::User->fetch_config($self->{login});
$self->{_locale} = $locale;
$self->{stylesheet} = $self->{_user}->{stylesheet};
if ( $self->{password} ) {
diff --git a/LedgerSMB/Session/DB.pm b/LedgerSMB/Session/DB.pm
index 592d0922..849b4ddf 100755
--- a/LedgerSMB/Session/DB.pm
+++ b/LedgerSMB/Session/DB.pm
@@ -43,7 +43,6 @@ sub session_check {
"SELECT u.username, s.transaction_id
FROM session as s, users as u
WHERE s.session_id = ?
- AND s.token = ?
AND s.users_id = u.id
AND s.last_used > now() - ?::interval"
);
@@ -73,7 +72,7 @@ sub session_check {
$timeout = "$myconfig{timeout} seconds";
}
- $checkQuery->execute( $sessionID, $token, $timeout )
+ $checkQuery->execute( $sessionID, $timeout )
|| $form->dberror(
__FILE__ . ':' . __LINE__ . ': Looking for session: ' );
my $sessionValid = $checkQuery->rows;
diff --git a/am.pl b/am.pl
index 7319efed..2e06f6a9 100755
--- a/am.pl
+++ b/am.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/ap.pl b/ap.pl
index 7319efed..2e06f6a9 100755
--- a/ap.pl
+++ b/ap.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/ar.pl b/ar.pl
index 7319efed..2e06f6a9 100755
--- a/ar.pl
+++ b/ar.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/bp.pl b/bp.pl
index 7319efed..2e06f6a9 100755
--- a/bp.pl
+++ b/bp.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/ca.pl b/ca.pl
index 7319efed..2e06f6a9 100755
--- a/ca.pl
+++ b/ca.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/cp.pl b/cp.pl
index 7319efed..2e06f6a9 100755
--- a/cp.pl
+++ b/cp.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/css/scripts/login.css b/css/scripts/login.css
index ef7bdae9..af54e854 100644
--- a/css/scripts/login.css
+++ b/css/scripts/login.css
@@ -11,7 +11,7 @@ div.login {
div.login div.login {
width: 21em;
height: 18em;
- border-width: 1;
+ border-width: 1px;
border-style: solid;
padding-bottom: 2em;
}
diff --git a/ct.pl b/ct.pl
index 7319efed..2e06f6a9 100755
--- a/ct.pl
+++ b/ct.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/employee.pl b/employee.pl
index 7319efed..2e06f6a9 100755
--- a/employee.pl
+++ b/employee.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/gl.pl b/gl.pl
index 7319efed..2e06f6a9 100755
--- a/gl.pl
+++ b/gl.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/hr.pl b/hr.pl
index 7319efed..2e06f6a9 100755
--- a/hr.pl
+++ b/hr.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/ic.pl b/ic.pl
index 7319efed..2e06f6a9 100755
--- a/ic.pl
+++ b/ic.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/ir.pl b/ir.pl
index 7319efed..2e06f6a9 100755
--- a/ir.pl
+++ b/ir.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/is.pl b/is.pl
index 7319efed..2e06f6a9 100755
--- a/is.pl
+++ b/is.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/jc.pl b/jc.pl
index 7319efed..2e06f6a9 100755
--- a/jc.pl
+++ b/jc.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/location.pl b/location.pl
index 7319efed..2e06f6a9 100755
--- a/location.pl
+++ b/location.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/lsmb-request.pl b/lsmb-request.pl
index 47eec723..069d03d0 100644
--- a/lsmb-request.pl
+++ b/lsmb-request.pl
@@ -48,7 +48,7 @@ if (!$script){
}
eval { require "scripts/$script" }
- || $request->error($locale->text('Unable to open script') . ": $!");
+ || $request->error($locale->text('Unable to open script') . ": $script : $!");
$script =~ s/\.pl$//;
$script = "LedgerSMB::Scripts::$script";
diff --git a/menu.pl b/menu.pl
index 3b98cb0d..76f60115 100755
--- a/menu.pl
+++ b/menu.pl
@@ -1,206 +1,3 @@
#!/usr/bin/perl
-#
-######################################################################
-# LedgerSMB Accounting and ERP
-
-# http://www.ledgersmb.org/
-#
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (C) 2001
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-# Contributors:
-#
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# this script is the frontend called from bin/$terminal/$script
-# all the accounting modules are linked to this script which in
-# turn execute the same script in bin/$terminal/
-#
-#######################################################################
-
-use LedgerSMB::Sysconfig;
-use Digest::MD5;
-use Error qw(:try);
-
-$| = 1;
-
-use LedgerSMB::User;
-use LedgerSMB::Form;
-use LedgerSMB::Locale;
-use LedgerSMB::Session;
-use Data::Dumper;
-require "common.pl";
-
-# for custom preprocessing logic
-eval { require "custom.pl"; };
-
-$form = new Form;
-
-# name of this script
-$0 =~ tr/\\/\//;
-$pos = rindex $0, '/';
-$script = substr( $0, $pos + 1 );
-
-$locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} )
- or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
-
-# we use $script for the language module
-$form->{script} = $script;
-
-# strip .pl for translation files
-$script =~ s/\.pl//;
-
-# pull in DBI
-use DBI qw(:sql_types);
-
-# send warnings to browser
-$SIG{__WARN__} = sub { $form->info( $_[0] ) };
-
-# send errors to browser
-$SIG{__DIE__} =
- sub { $form->error( __FILE__ . ':' . __LINE__ . ': ' . $_[0] ) };
-
-## did sysadmin lock us out
-#if (-f "${LedgerSMB::Sysconfig::userspath}/nologin") {
-# $locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}) or
-# $form->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
-# $form->{charset} = 'UTF-8';
-# $locale->encoding('UTF-8');
-#
-# $form->{callback} = "";
-# $form->error(__FILE__.':'.__LINE__.': '.$locale->text('System currently down for maintenance!'));
-#}
-
-&check_password;
-
-# grab user config. This is ugly and unecessary if/when
-# we get rid of myconfig and use User as a real object
-%myconfig = %{ LedgerSMB::User->fetch_config( $form->{login} ) };
-$locale = LedgerSMB::Locale->get_handle( $myconfig{countrycode} )
- or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
-
-# locale messages
-#$form->{charset} = $locale->encoding;
-$form->{charset} = 'UTF-8';
-$locale->encoding('UTF-8');
-
-if ($@) {
- $form->{callback} = "";
- $msg1 = $locale->text('You are logged out!');
- $msg2 = $locale->text('Login');
- $form->redirect(
- "$msg1 <p><a href=\"login.pl\" target=\"_top\">$msg2</a></p>");
-}
-
-map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout)
- unless ( $form->{type} eq 'preferences' );
-
-$form->db_init( \%myconfig );
-
-# pull in the main code
-require "bin/$form->{script}";
-
-# customized scripts
-if ( -f "bin/custom/$form->{script}" ) {
- eval { require "bin/custom/$form->{script}"; };
-}
-
-# customized scripts for login
-if ( -f "bin/custom/$form->{login}_$form->{script}" ) {
- eval { require "bin/custom/$form->{login}_$form->{script}"; };
-}
-
-if ( $form->{action} ) {
-
- # window title bar, user info
- $form->{titlebar} =
- "LedgerSMB "
- . $locale->text('Version')
- . " $form->{version} - $myconfig{name} - $myconfig{dbname}";
-
- &{ $form->{action} };
-
-}
-else {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('action= not defined!') );
-}
-
-1;
-
-# end
-
-sub check_password {
-
- require "bin/pw.pl";
-
- if ( $form->{password} ) {
- if (
- !Session::password_check(
- $form, $form->{login}, $form->{password}
- )
- )
- {
- if ( $ENV{GATEWAY_INTERFACE} ) {
- &getpassword;
- }
- else {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('Access Denied!') );
- }
- exit;
- }
- else {
- Session::session_create($form);
- }
-
- }
- else {
- if ( $ENV{GATEWAY_INTERFACE} ) {
- $ENV{HTTP_COOKIE} =~ s/;\s*/;/g;
- @cookies = split /;/, $ENV{HTTP_COOKIE};
- foreach (@cookies) {
- ( $name, $value ) = split /=/, $_, 2;
- $cookie{$name} = $value;
- }
-
- #check for valid session
- if ( !Session::session_check( $cookie{"LedgerSMB"}, $form ) ) {
- &getpassword(1);
- exit;
- }
- }
- else {
- exit;
- }
- }
-}
+require "lsmb-request.pl";
diff --git a/oe.pl b/oe.pl
index 7319efed..2e06f6a9 100755
--- a/oe.pl
+++ b/oe.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/old-handler.pl b/old-handler.pl
new file mode 100755
index 00000000..3b98cb0d
--- /dev/null
+++ b/old-handler.pl
@@ -0,0 +1,206 @@
+#!/usr/bin/perl
+#
+######################################################################
+# LedgerSMB Accounting and ERP
+
+# http://www.ledgersmb.org/
+#
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (C) 2001
+#
+# Author: Dieter Simader
+# Email: dsimader@sql-ledger.org
+# Web: http://www.sql-ledger.org
+#
+# Contributors:
+#
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#######################################################################
+#
+# this script is the frontend called from bin/$terminal/$script
+# all the accounting modules are linked to this script which in
+# turn execute the same script in bin/$terminal/
+#
+#######################################################################
+
+use LedgerSMB::Sysconfig;
+use Digest::MD5;
+use Error qw(:try);
+
+$| = 1;
+
+use LedgerSMB::User;
+use LedgerSMB::Form;
+use LedgerSMB::Locale;
+use LedgerSMB::Session;
+use Data::Dumper;
+require "common.pl";
+
+# for custom preprocessing logic
+eval { require "custom.pl"; };
+
+$form = new Form;
+
+# name of this script
+$0 =~ tr/\\/\//;
+$pos = rindex $0, '/';
+$script = substr( $0, $pos + 1 );
+
+$locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} )
+ or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+
+# we use $script for the language module
+$form->{script} = $script;
+
+# strip .pl for translation files
+$script =~ s/\.pl//;
+
+# pull in DBI
+use DBI qw(:sql_types);
+
+# send warnings to browser
+$SIG{__WARN__} = sub { $form->info( $_[0] ) };
+
+# send errors to browser
+$SIG{__DIE__} =
+ sub { $form->error( __FILE__ . ':' . __LINE__ . ': ' . $_[0] ) };
+
+## did sysadmin lock us out
+#if (-f "${LedgerSMB::Sysconfig::userspath}/nologin") {
+# $locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}) or
+# $form->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
+# $form->{charset} = 'UTF-8';
+# $locale->encoding('UTF-8');
+#
+# $form->{callback} = "";
+# $form->error(__FILE__.':'.__LINE__.': '.$locale->text('System currently down for maintenance!'));
+#}
+
+&check_password;
+
+# grab user config. This is ugly and unecessary if/when
+# we get rid of myconfig and use User as a real object
+%myconfig = %{ LedgerSMB::User->fetch_config( $form->{login} ) };
+$locale = LedgerSMB::Locale->get_handle( $myconfig{countrycode} )
+ or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+
+# locale messages
+#$form->{charset} = $locale->encoding;
+$form->{charset} = 'UTF-8';
+$locale->encoding('UTF-8');
+
+if ($@) {
+ $form->{callback} = "";
+ $msg1 = $locale->text('You are logged out!');
+ $msg2 = $locale->text('Login');
+ $form->redirect(
+ "$msg1 <p><a href=\"login.pl\" target=\"_top\">$msg2</a></p>");
+}
+
+map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout)
+ unless ( $form->{type} eq 'preferences' );
+
+$form->db_init( \%myconfig );
+
+# pull in the main code
+require "bin/$form->{script}";
+
+# customized scripts
+if ( -f "bin/custom/$form->{script}" ) {
+ eval { require "bin/custom/$form->{script}"; };
+}
+
+# customized scripts for login
+if ( -f "bin/custom/$form->{login}_$form->{script}" ) {
+ eval { require "bin/custom/$form->{login}_$form->{script}"; };
+}
+
+if ( $form->{action} ) {
+
+ # window title bar, user info
+ $form->{titlebar} =
+ "LedgerSMB "
+ . $locale->text('Version')
+ . " $form->{version} - $myconfig{name} - $myconfig{dbname}";
+
+ &{ $form->{action} };
+
+}
+else {
+ $form->error( __FILE__ . ':' . __LINE__ . ': '
+ . $locale->text('action= not defined!') );
+}
+
+1;
+
+# end
+
+sub check_password {
+
+ require "bin/pw.pl";
+
+ if ( $form->{password} ) {
+ if (
+ !Session::password_check(
+ $form, $form->{login}, $form->{password}
+ )
+ )
+ {
+ if ( $ENV{GATEWAY_INTERFACE} ) {
+ &getpassword;
+ }
+ else {
+ $form->error( __FILE__ . ':' . __LINE__ . ': '
+ . $locale->text('Access Denied!') );
+ }
+ exit;
+ }
+ else {
+ Session::session_create($form);
+ }
+
+ }
+ else {
+ if ( $ENV{GATEWAY_INTERFACE} ) {
+ $ENV{HTTP_COOKIE} =~ s/;\s*/;/g;
+ @cookies = split /;/, $ENV{HTTP_COOKIE};
+ foreach (@cookies) {
+ ( $name, $value ) = split /=/, $_, 2;
+ $cookie{$name} = $value;
+ }
+
+ #check for valid session
+ if ( !Session::session_check( $cookie{"LedgerSMB"}, $form ) ) {
+ &getpassword(1);
+ exit;
+ }
+ }
+ else {
+ exit;
+ }
+ }
+}
+
diff --git a/pe.pl b/pe.pl
index 7319efed..2e06f6a9 100755
--- a/pe.pl
+++ b/pe.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/ps.pl b/ps.pl
index 7319efed..2e06f6a9 100755
--- a/ps.pl
+++ b/ps.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/rc.pl b/rc.pl
index 7319efed..2e06f6a9 100755
--- a/rc.pl
+++ b/rc.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/rp.pl b/rp.pl
index 7319efed..2e06f6a9 100755
--- a/rp.pl
+++ b/rp.pl
@@ -1,2 +1,2 @@
#!/usr/bin/perl
-require "menu.pl";
+require "old-handler.pl";
diff --git a/scripts/login.pl b/scripts/login.pl
index b07d9c3d..bdd98037 100644
--- a/scripts/login.pl
+++ b/scripts/login.pl
@@ -30,28 +30,8 @@ sub login {
if (!$request->{_user}){
__default($request);
}
- our $user = new LedgerSMB::User($request->{login});
- our $form = new Form;
- for (keys %$request){
- $form->{$_} = $request->{$_};
- }
- my $menu_entrypoint;
- require "bin/menu.pl";
- if (($request->{_user}->{acs} !~ /Recurring Transactions/) ||
- $request->{_user}->{role} ne 'user'){
- if ($user->check_recurring($form) ) {
- $form->{main} = "recurring_transactions";
- }
- else {
- $form->{main} = "company_logo";
- }
-
- }
- else {
-
- $form->{main} = "company_logo";
- }
- &display;
+ require "scripts/menu.pl";
+ LedgerSMB::Scripts::menu::display($request);
}