Ran PHPCBF on PHP files

This commit is contained in:
2019-08-27 00:31:46 +02:00
committed by Stefan Rohde-Enslin
parent f7140573e1
commit 4abb415054
16 changed files with 857 additions and 954 deletions

View File

@ -3,40 +3,37 @@
//ini_set('display_errors',1);
ob_start();
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; // für ungarn sonst weg //////////////////////
include ('inc/zeichen.php');
$filename=$_GET['fnam'];
$csv_datei = 'csv/'.$filename;
require 'inc/zeichen.php';
$filename = $_GET['fnam'];
$csv_datei = 'csv/' . $filename;
mkdir("xml",0777);
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="UTF-8"?>'."\n"; // für Ungarn ///////////////////////////////////
$somecontent=$somecontent.'<record>'."\n";
$y++;
$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 = $somecontent . '<record>' . "\n";
for ( $x = 0; $x < count ( $zeile ); $x++ )
{
$inhalt[$y][$x]=$zeile[$x];
$inhalt[$y][$x] = preg_replace('/[\x00-\x1F\x7F]/u', '', $inhalt[$y][$x]);
$inhalt[$y][$x] = str_replace('>',']',str_replace('<','[',$inhalt[$y][$x]));
//if ($y!=1) $inhalt[$y][$x] = '<![CDATA['.$inhalt[$y][$x].']]>';
$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).'</'.tagify(transform($inhalt[1][$x])).'>'."\n"; //für ungarn sonst weg }
}
$somecontent=$somecontent.'</record>';
if (fwrite($handle, $somecontent) === FALSE)
{
echo "Cannot write to file ($filename)";exit;
}
fclose($handle);
for ($x = 0; $x < count ( $zeile ); $x++)
{
$inhalt[$y][$x] = $zeile[$x];
$inhalt[$y][$x] = preg_replace('/[\x00-\x1F\x7F]/u', '', $inhalt[$y][$x]);
$inhalt[$y][$x] = str_replace('>', ']', str_replace('<', '[', $inhalt[$y][$x]));
//if ($y!=1) $inhalt[$y][$x] = '<![CDATA['.$inhalt[$y][$x].']]>';
$somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . (($inhalt[$y][$x])) . '</' . tagify(transform($inhalt[1][$x])) . '>' . "\n"; //für ungarn sonst weg }
}
$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 ($y - 1) . ' files created';
echo '<br><a href="zipit.php"><img src="img/go.gif"> Download as zip</a>';
?>