Remove obsolete files for generating iso8859 XML files

This commit is contained in:
Joshua Ramon Enslin 2019-09-01 19:58:23 +02:00 committed by Stefan Rohde-Enslin
parent 13395387a0
commit 1f766c7eca
6 changed files with 20 additions and 82 deletions

View File

@ -75,5 +75,5 @@ else
header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}.csv"); header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}.csv");
for ($i = 2; $i <= 4; $i++) { for ($i = 2; $i <= 4; $i++) {
echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16','utf-8');; echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16', 'utf-8');;
} }

View File

@ -73,8 +73,8 @@ $fp = fopen ( $csv_datei, 'r' );
$y = 1; $y = 1;
$error = 0; $error = 0;
$zeile = fgetcsv ( $fp, 100000, ';' ); $zeile = fgetcsv ( $fp, 100000, ';' );
for ($x = 0; $x < count ( $zeile ); $x++) for ($x = 0; $x < count($zeile); $x++) {
{
$zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]); $zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]);
$inhalt[$y][$x] = $zeile[$x]; $inhalt[$y][$x] = $zeile[$x];
if (!in_array($inhalt[1][$x], $allowed)) { if (!in_array($inhalt[1][$x], $allowed)) {
@ -354,8 +354,7 @@ if ($hasanyimage > 0) {
if (isset($errormessage) and $errormessage != '') { if (isset($errormessage) and $errormessage != '') {
echo '<b style="color:#990000;">There is not one main image for each object !</b>'; echo '<b style="color:#990000;">There is not one main image for each object !</b>';
for ($i = 0; $i < count ($errormessage); $i++) for ($i = 0; $i < count($errormessage); $i++) {
{
echo '<br>' . $errormessage[$i]; echo '<br>' . $errormessage[$i];
$error++; $error++;
} }
@ -364,8 +363,7 @@ if ($hasanyimage > 0) {
echo '<i style="font-style:normal;color:#009900;">For each object that has images attached exactly one main image is given !</i>'; echo '<i style="font-style:normal;color:#009900;">For each object that has images attached exactly one main image is given !</i>';
} }
} }
else else {
{
echo '<i style="font-style:normal;color:#009900;">No images to be imported !</i>'; echo '<i style="font-style:normal;color:#009900;">No images to be imported !</i>';
} }
@ -375,6 +373,5 @@ if ($error + $depcon_error > 0) {
<p>Error(s) found: ' . ($error + $depcon_error) . '</p>'; <p>Error(s) found: ' . ($error + $depcon_error) . '</p>';
} }
else { else {
echo '<a href="index5.php?fnam=' . $_GET['fnam'] . '"><img src="img/go.gif"> Create XML for md:import (iso 8859-1)</a><br>'; echo '<a href="index6.php?fnam=' . htmlspecialchars($_GET['fnam']) . '" class="buttonLike">Create XML for md:import (utf8)</a><br>';
echo '<a href="index6.php?fnam=' . $_GET['fnam'] . '"><img src="img/go.gif"> Create XML for md:import (utf8)</a><br>';
} }

View File

@ -1,43 +0,0 @@
<?php
ob_start();
require_once 'inc/zeichen.php';
$filename = $_GET['fnam'];
$csv_datei = 'csv/' . $filename;
mkdir("xml", 0777);
$fp = fopen ( $csv_datei, 'r' );
$y = 0;
while ( $zeile = fgetcsv ( $fp, 100000, ';' ) )
{
$y++;
//echo '<b>Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'</b><br>';
$zieldatei = 'xml/' . $y . '.xml';
if (!$handle = fopen($zieldatei, 'w')) {
echo "Cannot open file ($zieldatei)";exit;
}
$somecontent = '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"; // normal
$somecontent = $somecontent . '<record>' . "\n";
for ($x = 0; $x < count ( $zeile ); $x++)
{
$inhalt[$y][$x] = $zeile[$x];
//echo '<b>'.$inhalt[1][$x].'</b> --> '.$zeile[$x].'<br>';
if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ';
//$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).'</'.tagify(transform($inhalt[1][$x])).'>'."\n"; // für utf8
//$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).'</'.tagify(transform($inhalt[1][$x])).'>'."\n"; //für ungarn sonst weg //////////////////////////////////////////////////////////////
$somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '</' . tagify(transform($inhalt[1][$x])) . '>' . "\n"; //normaleinstellung
}
$somecontent = $somecontent . '</record>';
//if ($y>1)
//{
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";exit;
}
// echo "Success, wrote to file ($filename)<br><br>";
//}
fclose($handle);
}
fclose($fp);
echo ($y - 1) . ' files created';
echo '<br><a href="zipit.php"><img src="img/go.gif"> Download as zip</a>';

View File

@ -1,16 +0,0 @@
<?PHP
echo '<link rel="stylesheet" type="text/css" href="css/main.css">';
echo '<div class="title">';
echo 'museum-digital CSV to XML converter';
echo '</div>';
echo '<div class="maincontent">';
$semikoma = $_GET['semikoma'];
echo '<table border="0" cellpadding="0" cellspacing="0" summary="" width="100%">';
echo '<tr>';
echo '<td width="50%">';
echo 'Please wait ... (transforming)<hr>';
require 'csv_laden.php';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</div>';