Consider the possibility that “our languages” have been locked

This commit is contained in:
pezcurrel 2022-12-28 19:17:05 +01:00
parent 0b15bcac6b
commit db749d2e7d

View file

@ -643,17 +643,20 @@ if ($instanswered && isset($idata['languages']) && is_array($idata['languages'])
}
}
// we try to detect languages only if it's set to the default "en", otherwise it has been explicitly set by admin and we assume it's the mostly used language
if ($idata['languages'][0]=='en') {
$dool=true;
if (!is_null($oidata) && $oidata['OurLangsLock']==1) {
$dool=false;
} elseif ($idata['languages'][0]=='en') {
$idata['ourlanguages']=get_instance_langs($opts['hostname']);
while (count($idata['ourlanguages'])>5)
array_pop($languages);
foreach ($idata['ourlanguages'] as $key=>$lang)
$idata['ourlanguages'][$key]=str_replace('-','_',$lang);
eecho(1,'«'.$opts['hostname'].'»: detected languages: '.implode(', ',$idata['ourlanguages']).N);//+++
eecho(1,'«'.$opts['hostname'].'»: detected languages: '.implode(', ',$idata['ourlanguages']).N);
} else {
$idata['ourlanguages']=$idata['languages'];
}
if (!$opts['dryrun']) {
if ($dool && !$opts['dryrun']) {
myq($link,'DELETE FROM InstOurLangs WHERE InstID='.$instid,__LINE__);
$pos=0;
foreach ($idata['ourlanguages'] as $lang) {