summaryrefslogtreecommitdiff
path: root/menu.pl
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-20 19:33:15 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-20 19:33:15 +0000
commit0985ef49e6f5a86a0eedfb65ac7b2a5d45ccc0e6 (patch)
tree3291ee0187d1d09510152686bc84b3c561ecf2cf /menu.pl
parent32bef12db72e5b8c2c9b2921f9204c9909c79033 (diff)
Rearranging menu.pl
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@959 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'menu.pl')
-rwxr-xr-xmenu.pl41
1 files changed, 21 insertions, 20 deletions
diff --git a/menu.pl b/menu.pl
index 12e2e50a..7501df85 100755
--- a/menu.pl
+++ b/menu.pl
@@ -77,23 +77,28 @@ $script =~ s/\.pl//;
# pull in DBI
use DBI qw(:sql_types);
-# 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})};
+# send warnings to browser
+$SIG{__WARN__} = sub { $form->info($_[0]) };
-if ($@) {
- $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or
+# 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} = $locale->encoding;
$form->{charset} = 'UTF-8';
$locale->encoding('UTF-8');
$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>");
+ $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 messages
$locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or
$form->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
@@ -101,19 +106,16 @@ $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or
$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]) };
+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);
-# 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}";
@@ -133,7 +135,6 @@ if ($form->{action}) {
# window title bar, user info
$form->{titlebar} = "LedgerSMB ".$locale->text('Version'). " $form->{version} - $myconfig{name} - $myconfig{dbname}";
- &check_password;
&{ $form->{action} };