From 6c5c1c36fa682244c355f6c06808ec715f0a2baa Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 26 Apr 2007 20:28:38 +0000 Subject: Merging bugfixes from current branches/1.2 git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1105 4979c152-3d1c-0410-bac9-87ea11338e46 --- menu.pl | 63 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'menu.pl') diff --git a/menu.pl b/menu.pl index fbbcb575..3b98cb0d 100755 --- a/menu.pl +++ b/menu.pl @@ -69,6 +69,9 @@ $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; @@ -78,18 +81,38 @@ $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" ); -if ($@) { - $locale = LedgerSMB::Locale->get_handle( $myconfig{countrycode} ) - or - $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" ); - $form->{charset} = $locale->encoding; - $form->{charset} = 'UTF-8'; - $locale->encoding('UTF-8'); +# 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'); @@ -97,32 +120,10 @@ if ($@) { "$msg1

$msg2

"); } -# locale messages -$locale = LedgerSMB::Locale->get_handle( $myconfig{countrycode} ) - or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" ); - -#$form->{charset} = $locale->encoding; -$form->{charset} = 'UTF-8'; -$locale->encoding('UTF-8'); - -# send warnings to browser -$SIG{__WARN__} = sub { $form->info( $_[0] ) }; - -# send errors to browser -$SIG{__DIE__} = - sub { $form->error( __FILE__ . ':' . __LINE__ . ': ' . $_[0] ) }; - map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout) unless ( $form->{type} eq 'preferences' ); -$form->db_init( \%myconfig ); - -if ( $form->{path} ne 'bin/lynx' ) { $form->{path} = 'bin/mozilla'; } -# did sysadmin lock us out -if ( -f "${LedgerSMB::Sysconfig::userspath}/nologin" ) { - $form->error( __FILE__ . ':' . __LINE__ . ': ' - . $locale->text('System currently down for maintenance!') ); -} +$form->db_init( \%myconfig ); # pull in the main code require "bin/$form->{script}"; @@ -145,8 +146,6 @@ if ( $form->{action} ) { . $locale->text('Version') . " $form->{version} - $myconfig{name} - $myconfig{dbname}"; - &check_password; - &{ $form->{action} }; } -- cgit v1.2.3