"fixed not correctly translated holidays downloaded from egroupware.org

(charset was not recogniced because of HTTP headers before charset line)"
This commit is contained in:
Ralf Becker 2009-04-09 07:14:07 +00:00
parent cb46bce9cf
commit 1c1ae40e40

View File

@ -291,16 +291,23 @@
$lines = @file(EGW_SERVER_ROOT.'/calendar/egroupware.org/holidays.'.strtoupper($locale).'.csv');
}
else
{
$lines = $network->gethttpsocketfile($load_from.'/holidays.'.strtoupper($locale).'.csv');
}
if (!$lines)
{
return false;
}
$charset = split("[\t\n ]+",$lines[0]); // give a bit flexibility in the syntax AND remove the lineend (\n)
if (strpos($charset[0],'charset') !== false && $charset[1])
// reading the holidayfile from egroupware.org via network::gethttpsocketfile contains all the headers!
foreach($lines as $n => $line)
{
$lines = $GLOBALS['egw']->translation->convert($lines,$charset[1]);
$fields = split("[\t\n ]+",$line);
if ($fields[0] == 'charset' && $fields[1])
{
$lines = $GLOBALS['egw']->translation->convert($lines,$fields[1]);
break;
}
}
$c_lines = count($lines);
foreach ($lines as $i => $line)