summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-23 01:14:57 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-23 01:14:57 +0000
commita151b3ee989fd4c82af3717463fc528269d139ff (patch)
tree9399f2078945e25e42134e2b1f1c2d738b199d3d
parent4979b0d0d396e57346feb2ff85dc34f9b068ff6c (diff)
Applying patch 15998004
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@692 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/User.pm38
-rwxr-xr-xbin/admin.pl1
2 files changed, 13 insertions, 26 deletions
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index e28af072..8cc551bc 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -71,10 +71,6 @@ sub new {
chomp($self->{dbname});
chomp($self->{dbhost});
- if(! int($self->{dbport})){#in case there's a space or junk in the dbport
- $self->{dbport} = '5432';
- }
-
$self->{dbconnect} = 'dbi:Pg:dbname='.$self->{dbname}.';host='.$self->{dbhost}.';port='.$self->{dbport};
if($self->{username}){
@@ -142,13 +138,10 @@ sub fetch_config {
$myconfig{$key} = $value;
}
- if(! int($myconfig{'dbport'})){#in case there's a space or junk in the dbport
- $myconfig{'dbport'} = '5432';
- }
+ chomp($myconfig{'dbport'});
+ chomp($myconfig{'dbname'});
+ chomp($myconfig{'dbhost'});
- if (! $myconfig{'dbhost'}){ # necessary to avoid many issues
- $myconfig{'dbhost'} = 'localhost';
- }
$myconfig{'login'} = $login;
$myconfig{'dbconnect'} = 'dbi:Pg:dbname='.$myconfig{'dbname'}.';host='.$myconfig{'dbhost'}.';port='.$myconfig{'dbport'};
}
@@ -277,21 +270,8 @@ sub dbconnect_vars {
$form->{dboptions} = $dboptions{$form->{dbdriver}}{$form->{dateformat}};
$form->{dbconnect} = "dbi:$form->{dbdriver}:dbname=$db";
-
-
- if ($form->{dbhost}) {
- $form->{dbconnect} .= ";host=$form->{dbhost}";
-
- } else {
- $form->{dbconnect} .= ";host=localhost";
- }
-
-
- if ($form->{dbport}) {
- $form->{dbconnect} .= ";port=$form->{dbport}";
- } else {
- $form->{dbconnect} .= ";port=5432";
- }
+ $form->{dbconnect} .= ";host=$form->{dbhost}";
+ $form->{dbconnect} .= ";port=$form->{dbport}";
}
@@ -720,6 +700,14 @@ sub save_member {
my $userCheck = $dbh->prepare("SELECT id FROM users WHERE username = ?");
$userCheck->execute($self->{login});
my ($userID) = $userCheck->fetchrow_array;
+
+ if (! $self->{dbhost}) {
+ $self->{dbhost} = 'localhost';
+ }
+ if (! $self->{dbport}) {
+ $self->{dbport} = '5432';
+ }
+
my $userConfExists = 0;
if($userID){
diff --git a/bin/admin.pl b/bin/admin.pl
index 0fe64cc5..47f8c5ae 100755
--- a/bin/admin.pl
+++ b/bin/admin.pl
@@ -270,7 +270,6 @@ sub list_users {
$href =~ s/ /%20/g;
$member{$key}{templates} =~ s/^${LedgerSMB::Sysconfig::templates}\///;
- $member{$key}{dbhost} = 'localhost' unless $member{$key}{dbhost};
$column_data{login} = qq|<td><a href="$href">$key</a></td>|;
$column_data{name} = qq|<td>$member{$key}{name}</td>|;