[vhffs-dev] [1525] Now updating theme and language fields accordingly to the wanted modification before displaying them |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [1525] Now updating theme and language fields accordingly to the wanted modification before displaying them
- From: subversion@xxxxxxxxxxxxx
- Date: Sat, 07 Nov 2009 00:30:35 +0100
Revision: 1525
Author: gradator
Date: 2009-11-07 00:30:34 +0100 (Sat, 07 Nov 2009)
Log Message:
-----------
Now updating theme and language fields accordingly to the wanted modification before displaying them
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel/User.pm
trunk/vhffs-panel/user/prefs.pl
Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm 2009-09-08 16:31:37 UTC (rev 1524)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm 2009-11-06 23:30:34 UTC (rev 1525)
@@ -236,14 +236,13 @@
{
my $user = shift;
my $lang = shift;
-
- return -1 if ( ( ! defined $user ) || ( ! defined $lang ) );
+ return -1 unless defined $user and defined $lang;
- my $sql = 'UPDATE vhffs_users SET language = ? WHERE uid = ?';
- my $sth = $user->{db}->prepare($sql);
- $sth->execute($lang, $user->get_uid) or return -1;
- $user->{language} = $lang;
- setlocale(LC_ALL, $lang);
+ my $sql = 'UPDATE vhffs_users SET language = ? WHERE uid = ?';
+ my $sth = $user->{db}->prepare($sql);
+ $sth->execute($lang, $user->get_uid) or return -1;
+ $user->{'language'} = $lang;
+ setlocale(LC_ALL, $lang);
}
@@ -251,13 +250,13 @@
{
my $user = shift;
my $theme = shift;
-
- return -1 if ( ( ! defined $user ) || ( ! defined $theme ) );
+ return -1 unless defined $user and defined $theme;
- my $sql = 'UPDATE vhffs_users SET theme = ? WHERE uid = ?';
- my $dbh = $user->{db};
- my $sth = $dbh->prepare($sql);
- $sth->execute($theme, $user->get_uid) or return -1;
+ my $sql = 'UPDATE vhffs_users SET theme = ? WHERE uid = ?';
+ my $dbh = $user->{db};
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($theme, $user->get_uid) or return -1;
+ $user->{'theme'} = $theme;
}
sub get_lang
Modified: trunk/vhffs-panel/user/prefs.pl
===================================================================
--- trunk/vhffs-panel/user/prefs.pl 2009-09-08 16:31:37 UTC (rev 1524)
+++ trunk/vhffs-panel/user/prefs.pl 2009-11-06 23:30:34 UTC (rev 1525)
@@ -102,13 +102,13 @@
my $pwd_change = 0;
my $mail_change = 0;
- if( $userp->{uid} == $user->{uid} ) {
+ if( $userp->{'uid'} == $user->{'uid'} ) {
# Checks data and perform requested modifications
$panel->add_cookie( CGI->cookie( -name=>'theme', -value=>$theme, -expires=>'+10y' ) );
- Vhffs::Panel::User::set_theme( $user, $theme );
+ Vhffs::Panel::User::set_theme( $userp, $theme );
$panel->add_cookie( CGI->cookie( -name=>'language', -value=>$lang, -expires=>'+10y' ) );
- Vhffs::Panel::User::set_lang( $user, $lang );
+ Vhffs::Panel::User::set_lang( $userp, $lang );
}
# Commit all the changes for the current user