This commit is contained in:
root 2006-08-15 23:00:25 +00:00
parent c42ca2897c
commit 02e0fca625
3 changed files with 27 additions and 4 deletions

View file

@ -1924,8 +1924,18 @@
if($oldid == 41 && $_REQUEST['action'] == 'addsec') if($oldid == 41 && $_REQUEST['action'] == 'addsec')
{ {
$lang = mysql_real_escape_string($_REQUEST['addlang']); $addlang = mysql_real_escape_string($_REQUEST['addlang']);
mysql_query("insert into `addlang` set `userid`='".$_SESSION['profile']['id']."', `lang`='$lang'"); mysql_query("insert into `addlang` set `userid`='".$_SESSION['profile']['id']."', `lang`='$addlang'");
showheader(_("My CAcert.org Account!"));
echo _("Your language setting has been updated.");
showfooter();
exit;
}
if($oldid == 41 && $_REQUEST['action'] == 'dellang')
{
$remove = mysql_real_escape_string($_REQUEST['remove']);
mysql_query("delete from `addlang` where `userid`='".$_SESSION['profile']['id']."' and `lang`='$remove'");
showheader(_("My CAcert.org Account!")); showheader(_("My CAcert.org Account!"));
echo _("Your language setting has been updated."); echo _("Your language setting has been updated.");
showfooter(); showfooter();

View file

@ -21,6 +21,7 @@
<td class="DataTD"><?=_("My prefered language")?>:</td> <td class="DataTD"><?=_("My prefered language")?>:</td>
<td class="DataTD"><select name="lang"> <td class="DataTD"><select name="lang">
<? <?
echo $_SESSION['_config']['language'];
foreach($_SESSION['_config']['translations'] as $key => $val) foreach($_SESSION['_config']['translations'] as $key => $val)
{ {
echo "<option value='$key'"; echo "<option value='$key'";
@ -44,6 +45,19 @@
<tr> <tr>
<td colspan="2" class="title"><?=_("Additional Language Preferences")?></td> <td colspan="2" class="title"><?=_("Additional Language Preferences")?></td>
</tr> </tr>
<?
$query = "select * from `addlang` where `userid`='".$_SESSION['profile']['id']."'";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
$lang = mysql_fetch_assoc(mysql_query("select * from `languages` where `locale`='${row['lang']}'"));
?>
<tr>
<td class="DataTD"><?=_("Additional Language")?>:</td>
<td class="DataTD" align="left"><? echo "${lang['lang']} - ${lang['country']}"; ?>
<a href="account.php?oldid=41&action=dellang&remove=<?=$row['lang']?>"><?=_("Delete")?></a></td>
</tr>
<? } ?>
<tr> <tr>
<td class="DataTD"><?=_("Secondary languages")?>:</td> <td class="DataTD"><?=_("Secondary languages")?>:</td>
<td class="DataTD"><select name="addlang"> <td class="DataTD"><select name="addlang">

View file

@ -52,9 +52,8 @@
<? <?
$query = "select * from `addlang` where `userid`='".$user['id']."'"; $query = "select * from `addlang` where `userid`='".$user['id']."'";
$res = mysql_query($query); $res = mysql_query($query);
if(mysql_num_rows($res) > 0) while($row = mysql_fetch_assoc($res))
{ {
$row = mysql_fetch_assoc($res);
$lang = mysql_fetch_assoc(mysql_query("select * from `languages` where `locale`='${row['lang']}'")); $lang = mysql_fetch_assoc(mysql_query("select * from `languages` where `locale`='${row['lang']}'"));
?> ?>
<tr> <tr>