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