removed locale saving in database - get locale from browser
git-svn-id: http://yolanda.mister-muffin.de/svn@316 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
0dcb16a8ec
commit
f15eaf0887
6 changed files with 8 additions and 46 deletions
|
@ -6,13 +6,13 @@ sub get_userinfo_from_sid
|
|||
my ($sid) = @_;
|
||||
|
||||
#prepare query
|
||||
my $sth = $dbh->prepare(qq{select id, username, locale, pagesize from users where sid = ?}) or die $dbh->errstr;
|
||||
my $sth = $dbh->prepare(qq{select id, username, pagesize from users where sid = ?}) or die $dbh->errstr;
|
||||
|
||||
#execute it
|
||||
$sth->execute($sid) or die $dbh->errstr;
|
||||
|
||||
#save the resulting username
|
||||
($userinfo->{'id'}, $userinfo->{'username'}, $userinfo->{'locale'}, $userinfo->{'pagesize'}) = $sth->fetchrow_array();
|
||||
($userinfo->{'id'}, $userinfo->{'username'}, $userinfo->{'pagesize'}) = $sth->fetchrow_array();
|
||||
|
||||
#finish query
|
||||
$sth->finish() or die $dbh->errstr;
|
||||
|
@ -26,19 +26,10 @@ sub get_page_array
|
|||
#get parameters
|
||||
my (@userinfo) = @_;
|
||||
|
||||
#if user is logged in, use his locale setting and check for new upload status
|
||||
if($userinfo->{'username'})
|
||||
($page->{'locale'}) = $query->http('HTTP_ACCEPT_LANGUAGE') =~ /^([^,]+),.*$/;
|
||||
if (!$page->{'locale'})
|
||||
{
|
||||
$page->{'locale'} = $userinfo->{'locale'};
|
||||
}
|
||||
#else get the locale from the http server variable
|
||||
else
|
||||
{
|
||||
($page->{'locale'}) = $query->http('HTTP_ACCEPT_LANGUAGE') =~ /^([^,]+),.*$/;
|
||||
unless($page->{'locale'})
|
||||
{
|
||||
$page->{'locale'} = "en_us";
|
||||
}
|
||||
$page->{'locale'} = "en_us";
|
||||
}
|
||||
|
||||
$page->{'username'} = $userinfo->{'username'};
|
||||
|
|
|
@ -39,7 +39,6 @@ $dbh->do(qq{create table
|
|||
password char(41) not null,
|
||||
sid char(32) not null,
|
||||
timestamp bigint not null,
|
||||
locale varchar(10) not null,
|
||||
pagesize tinyint unsigned default 5,
|
||||
primary key (id)
|
||||
)
|
||||
|
|
|
@ -205,7 +205,6 @@
|
|||
|
||||
<!-- settings page -->
|
||||
<string id="settings_heading">account settings for </string>
|
||||
<string id="settings_instruction_locale">locale</string>
|
||||
<string id="settings_instruction_pagesize">choose pagesize</string>
|
||||
|
||||
<!-- rss feed -->
|
||||
|
|
|
@ -39,8 +39,8 @@ elsif($query->param('user') and $query->param('pass') and $query->param('pass_re
|
|||
else
|
||||
{
|
||||
#insert new user
|
||||
$dbh->do(qq{insert into users (username, password, timestamp, locale) values ( ?, password( ? ), unix_timestamp(), ?)}, undef,
|
||||
$query->param("user"), $query->param("pass"), $page->{'locale'}) or die $dbh->errstr;
|
||||
$dbh->do(qq{insert into users (username, password, timestamp) values ( ?, password( ? ), unix_timestamp(), ?)}, undef,
|
||||
$query->param("user"), $query->param("pass")) or die $dbh->errstr;
|
||||
|
||||
print $query->redirect("index.pl?information=information_registered");
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ if($userinfo->{'username'})
|
|||
{
|
||||
if($query->param('submit'))
|
||||
{
|
||||
$dbh->do(qq{update users set locale = ?, pagesize = ? where id = ?}, undef, $query->param('locale'), $query->param('pagesize'), $userinfo->{'id'} ) or die $dbh->errstr;
|
||||
$dbh->do(qq{update users set pagesize = ? where id = ?}, undef, $query->param('pagesize'), $userinfo->{'id'} ) or die $dbh->errstr;
|
||||
|
||||
$page->{'message'}->{'type'} = "information";
|
||||
$page->{'message'}->{'text'} = "information_settings_changed";
|
||||
|
@ -24,7 +24,6 @@ if($userinfo->{'username'})
|
|||
|
||||
if($userinfo->{'username'})
|
||||
{
|
||||
$page->{'settings'}->{'locale'} = $userinfo->{'locale'};
|
||||
$page->{'settings'}->{'pagesize'} = $userinfo->{'pagesize'};
|
||||
}
|
||||
else
|
||||
|
|
|
@ -21,32 +21,6 @@
|
|||
<xsl:value-of select="$site_strings[@id='path_settings']" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:value-of select="$locale_strings[@id='settings_instruction_locale']" />
|
||||
<br />
|
||||
|
||||
<select name="locale" size="2">
|
||||
|
||||
<option value="en-us">
|
||||
<xsl:if test="//settings/@locale='en-us'">
|
||||
<xsl:attribute name="selected">
|
||||
selected
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="$locale_strings[@id='language_en-us']" />
|
||||
</option>
|
||||
|
||||
<option value="de-de">
|
||||
<xsl:if test="//settings/@locale='de-de'">
|
||||
<xsl:attribute name="selected">
|
||||
selected
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="$locale_strings[@id='language_de-de']" />
|
||||
</option>
|
||||
|
||||
</select>
|
||||
<br />
|
||||
|
||||
<xsl:value-of select="$locale_strings[@id='settings_instruction_pagesize']" />
|
||||
<br />
|
||||
|
||||
|
|
Loading…
Reference in a new issue