Remove and merge obsolete files csv_laden_hu_alt & csv_laden_iso

This commit is contained in:
Joshua Ramon Enslin 2019-08-30 23:13:46 +02:00 committed by Stefan Rohde-Enslin
parent 1fe3849713
commit e6272ddd17
5 changed files with 48 additions and 100 deletions

View File

@ -3,7 +3,6 @@ ob_start();
error_reporting(E_ALL);
ini_set('display_errors', 1);
require 'inc/zeichen.php';
$filename = $_GET['fnam'];
$csv_datei = 'csv/' . $filename;
@ -663,10 +662,10 @@ else
echo '<hr>';
if ($error + $depcon_error > 0) {
echo 'Error(s) found: ' . ($error + $depcon_error);
echo '
<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=' . $_GET['fnam'] . '"><img src="img/go.gif"> Create XML for md:import (utf8)</a><br>';
}

View File

@ -1,46 +0,0 @@
<?php
ob_start();
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; // für ungarn sonst weg //////////////////////
require '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, ';' ) )
//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="UTF-8"?>' . "\n"; // für Ungarn ///////////////////////////////////
/*$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
}
echo $y . '<br>';
$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 '<a href="zipit.php">download as zip</a>';

View File

@ -1,34 +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++;
$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];
//if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ';
$somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '</' . tagify(transform($inhalt[1][$x])) . '>' . "\n"; //normaleinstellung
}
$somecontent = $somecontent . '</record>';
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";exit;
}
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

@ -9,7 +9,38 @@ 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_iso.php';
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++;
$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];
//if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ';
$somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '</' . tagify(transform($inhalt[1][$x])) . '>' . "\n"; //normaleinstellung
}
$somecontent = $somecontent . '</record>';
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";exit;
}
fclose($handle);
}
fclose($fp);
echo ($y - 1) . ' files created';
echo '<br><a href="zipit.php"><img src="img/go.gif"> Download as zip</a>';
echo '</td>';
echo '</tr>';
echo '</table>';

View File

@ -1,21 +1,19 @@
<?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>';
declare(strict_types = 1);
require_once __DIR__ . "/functions/functions.php";
echo printHTMLHead();
echo '<div class="maincontent">';
$semikoma = $_GET['semikoma'];
echo '<table border="0" cellpadding="0" cellspacing="0" summary="" width="100%" style="border-bottom:1px solid #000000;padding-bottom:3px;margin-bottom:5px;">';
echo '<tr>';
echo '<td width="80%">';
echo 'Please wait ... (checking validity)';
echo '</td>';
echo '<td style="text-align:right;padding-top:0px;padding-bottom:0px;">';
echo '<form action="index.php" style="margin:0px;padding:0px;">';
echo '<input type="submit" value="Reload" />';
echo '</form>';
echo '</td>';
echo '</tr>';
echo '</table>';
require 'csv_check.php';
echo '</div>';
echo '
</body>
</html>
';