Fix type error
This commit is contained in:
parent
b0bdf698ab
commit
0ba9a3b1ec
|
@ -12,7 +12,7 @@ if (session_status() != PHP_SESSION_ACTIVE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This array contains all available languages
|
// This array contains all available languages
|
||||||
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl','pt'];
|
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl', 'pt'];
|
||||||
|
|
||||||
// Some languages are in translation. They will only be available for logged in users.
|
// Some languages are in translation. They will only be available for logged in users.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ if (session_status() != PHP_SESSION_ACTIVE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This array contains all available languages
|
// This array contains all available languages
|
||||||
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl','pt'];
|
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl', 'pt'];
|
||||||
|
|
||||||
// Some languages are in translation. They will only be available for logged in users.
|
// Some languages are in translation. They will only be available for logged in users.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ if (session_status() != PHP_SESSION_ACTIVE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This array contains all available languages
|
// This array contains all available languages
|
||||||
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl','pt'];
|
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl', 'pt'];
|
||||||
|
|
||||||
// Some languages are in translation. They will only be available for logged in users.
|
// Some languages are in translation. They will only be available for logged in users.
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ if (!($fp = fopen($csv_datei, 'r'))) {
|
||||||
throw new MDmainEntityNotExistentException("Failed opening file");
|
throw new MDmainEntityNotExistentException("Failed opening file");
|
||||||
}
|
}
|
||||||
$y = 0;
|
$y = 0;
|
||||||
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
while ($zeile = fgetcsv($fp, 100000, ';', "\"")) {
|
||||||
|
|
||||||
$zeile = str_replace("\xEF\xBB\xBF", '', $zeile);
|
$zeile = str_replace("\xEF\xBB\xBF", '', $zeile);
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||||
|
|
||||||
$zieldatei = __DIR__ . '/../xml/' . $y . '.xml';
|
$zieldatei = __DIR__ . '/../xml/' . $y . '.xml';
|
||||||
if (!$handle = fopen($zieldatei, 'w')) {
|
if (!$handle = fopen($zieldatei, 'w')) {
|
||||||
echo "Cannot open file ($zieldatei)";exit;
|
echo "Cannot open file ($zieldatei)";
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$xmlDoc = new DOMDocument("1.0", "UTF-8");
|
$xmlDoc = new DOMDocument("1.0", "UTF-8");
|
||||||
|
@ -52,13 +53,17 @@ while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||||
$record_node = $xmlDoc->appendChild($xmlMainElem); //add record element to XML node
|
$record_node = $xmlDoc->appendChild($xmlMainElem); //add record element to XML node
|
||||||
# $rss_node->setAttribute("version", "2.0"); //set RSS version
|
# $rss_node->setAttribute("version", "2.0"); //set RSS version
|
||||||
|
|
||||||
$lineCount = count($zeile);
|
if (empty($lineCount)) $lineCount = count($zeile);
|
||||||
|
|
||||||
for ($x = 0; $x < $lineCount; $x++) {
|
for ($x = 0; $x < $lineCount; $x++) {
|
||||||
$inhalt[$y][$x] = $zeile[$x];
|
$inhalt[$y][$x] = $zeile[$x];
|
||||||
if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ';
|
if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ';
|
||||||
|
|
||||||
$record_node->appendChild(createTextDomElement($xmlDoc, trim($inhalt[1][$x]), trim($inhalt[$y][$x])));
|
if (!isset($inhalt[1][$x])) {
|
||||||
|
echo "Error at position $x";
|
||||||
|
}
|
||||||
|
|
||||||
|
$record_node->appendChild(createTextDomElement($xmlDoc, trim($inhalt[1][$x] ?? ""), trim($inhalt[$y][$x] ?? "")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +72,9 @@ while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||||
# $somecontent .= '</record>';
|
# $somecontent .= '</record>';
|
||||||
//if ($y>1)
|
//if ($y>1)
|
||||||
//{
|
//{
|
||||||
if (fwrite($handle, $somecontent) === FALSE) {
|
if (fwrite($handle, $somecontent) === false) {
|
||||||
echo "Cannot write to file ($filename)";exit;
|
echo "Cannot write to file ($filename)";
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user