diff options
-rwxr-xr-x | LedgerSMB.pm | 2 | ||||
-rwxr-xr-x | LedgerSMB/Session/DB.pm | 3 | ||||
-rwxr-xr-x | am.pl | 2 | ||||
-rwxr-xr-x | ap.pl | 2 | ||||
-rwxr-xr-x | ar.pl | 2 | ||||
-rwxr-xr-x | bp.pl | 2 | ||||
-rwxr-xr-x | ca.pl | 2 | ||||
-rwxr-xr-x | cp.pl | 2 | ||||
-rw-r--r-- | css/scripts/login.css | 2 | ||||
-rwxr-xr-x | ct.pl | 2 | ||||
-rwxr-xr-x | employee.pl | 2 | ||||
-rwxr-xr-x | gl.pl | 2 | ||||
-rwxr-xr-x | hr.pl | 2 | ||||
-rwxr-xr-x | ic.pl | 2 | ||||
-rwxr-xr-x | ir.pl | 2 | ||||
-rwxr-xr-x | is.pl | 2 | ||||
-rwxr-xr-x | jc.pl | 2 | ||||
-rwxr-xr-x | location.pl | 2 | ||||
-rw-r--r-- | lsmb-request.pl | 2 | ||||
-rwxr-xr-x | menu.pl | 205 | ||||
-rwxr-xr-x | oe.pl | 2 | ||||
-rwxr-xr-x | old-handler.pl | 206 | ||||
-rwxr-xr-x | pe.pl | 2 | ||||
-rwxr-xr-x | ps.pl | 2 | ||||
-rwxr-xr-x | rc.pl | 2 | ||||
-rwxr-xr-x | rp.pl | 2 | ||||
-rw-r--r-- | scripts/login.pl | 24 |
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; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.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; } @@ -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"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.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"; @@ -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"; @@ -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; + } + } +} + @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.pl"; @@ -1,2 +1,2 @@ #!/usr/bin/perl -require "menu.pl"; +require "old-handler.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); } |