Now the logic to set the language for instances to be returned by default to the browser’s one is autonomous from the one to set the locale for text translation
This commit is contained in:
parent
544d287ba3
commit
468ca37cc0
1 changed files with 14 additions and 13 deletions
|
@ -361,23 +361,26 @@ function presub() {
|
|||
$_GET['exlcko']=0;
|
||||
}
|
||||
|
||||
$res=tquery('SELECT Languages.ID AS Lid, Code, CONCAT(Name'.$dlanguc.', \' [\', Code, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Instances ON Instances.ID=InstOurLangs.InstID LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstOurLangs.Pos=1 AND Instances.IsMastodon=1 AND Instances.Visible=1 AND Instances.LastOkCheckTS>='.$graceline.' GROUP BY Languages.ID ORDER BY Languages.Name'.$dlanguc.' ASC',__LINE__);
|
||||
while ($row=mysqli_fetch_assoc($res))
|
||||
$sellangs[$row['Code']]=$row;
|
||||
if (array_key_exists('lang',$_GET)) {
|
||||
if (preg_match('#^[0-9]+$#',$_GET['lang'])===1)
|
||||
$_GET['lang']=$_GET['lang']+0;
|
||||
($_GET['lang']+0>5000000) ? $get['lang']=0 : $_GET['lang']=$_GET['lang']+0;
|
||||
else
|
||||
$_GET['lang']=0;
|
||||
} else {
|
||||
$res=tquery('SELECT ID FROM Languages WHERE Code="'.myesc($link,$dlang).'"',__LINE__);
|
||||
if (mysqli_num_rows($res)>0) {
|
||||
$row=mysqli_fetch_assoc($res);
|
||||
$_GET['lang']=$row['ID'];
|
||||
} else {
|
||||
$_GET['lang']=0;
|
||||
}
|
||||
foreach ($langs as $key=>$val)
|
||||
if (array_key_exists($key,$sellangs)) {
|
||||
debug('LANG: '.$key.N,$debug);
|
||||
$_GET['lang']=$sellangs[$key]['Lid'];
|
||||
break;
|
||||
}
|
||||
if (!isset($_GET['lang']))
|
||||
$_GET['lang']=$sellangs['en']['Lid'];
|
||||
}
|
||||
if ($_GET['lang']>5000000000) $_GET['lang']=0;
|
||||
|
||||
if (array_key_exists('desc',$_GET) && preg_match('#^.+$#',$_GET['lang'])===1)
|
||||
if (array_key_exists('desc',$_GET) && preg_match('#^.+$#',$_GET['desc'])===1)
|
||||
$_GET['desc']=trim(n2es($_GET['desc']));
|
||||
else
|
||||
$_GET['desc']='';
|
||||
|
@ -447,9 +450,7 @@ function presub() {
|
|||
<select id="lang" name="lang" class="sselect" onchange="updord();">
|
||||
<option value="0"'.$selected.'>'._('Any').'</option>'.N;
|
||||
|
||||
$res=tquery('SELECT Languages.ID AS Lid, CONCAT(Name'.$dlanguc.', \' [\', Code, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Instances ON Instances.ID=InstOurLangs.InstID LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstOurLangs.Pos=1 AND Instances.IsMastodon=1 AND Instances.Visible=1 AND Instances.LastOkCheckTS>='.$graceline.' GROUP BY Languages.ID ORDER BY Languages.Name'.$dlanguc.' ASC',__LINE__);
|
||||
|
||||
while ($row=mysqli_fetch_assoc($res)) {
|
||||
foreach ($sellangs as $row) {
|
||||
($_GET['lang']==$row['Lid']) ? $selected=' selected' : $selected='';
|
||||
echo '<option value="'.$row['Lid'].'"'.$selected.'>'.$row['Txt'].'</option>'.N;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue