summaryrefslogtreecommitdiff
path: root/menu.pl
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-26 20:28:38 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-26 20:28:38 +0000
commit6c5c1c36fa682244c355f6c06808ec715f0a2baa (patch)
tree632efc981a5735f7b8d424a680469b71597dd495 /menu.pl
parent6a118bd31a09a9b8aaabd84f8876952e1cdd6459 (diff)
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
Diffstat (limited to 'menu.pl')
-rwxr-xr-xmenu.pl63
1 files changed, 31 insertions, 32 deletions
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 <p><a href=\"login.pl\" target=\"_top\">$msg2</a></p>");
}
-# 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} };
}