2019-08-25 21:45:52 +02:00
|
|
|
<?PHP
|
2019-09-01 19:54:01 +02:00
|
|
|
declare(strict_types = 1);
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
ini_set('display_errors', "1");
|
|
|
|
|
|
|
|
require_once __DIR__ . "/functions/functions.php";
|
|
|
|
|
|
|
|
if (session_status() != PHP_SESSION_ACTIVE) {
|
|
|
|
session_start();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This array contains all available languages
|
|
|
|
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl','pt'];
|
|
|
|
|
|
|
|
// Some languages are in translation. They will only be available for logged in users.
|
|
|
|
|
|
|
|
if (isset($_GET['navlang'])) {
|
|
|
|
$_SESSION['lang'] = $_GET['navlang'];
|
|
|
|
if (!in_array($_SESSION['lang'], $allowed_langs)) $_SESSION['lang'] = 'de';
|
|
|
|
}
|
|
|
|
else if (!isset($_SESSION['lang'])) {
|
|
|
|
$_SESSION['lang'] = lang_getfrombrowser($allowed_langs, 'en', "", false);
|
|
|
|
}
|
|
|
|
$lang = $_SESSION['lang'];
|
|
|
|
|
|
|
|
require __DIR__ . "/translation-importer/$lang/csvxml-overview.php";
|
|
|
|
|
|
|
|
echo printHTMLHead();
|
|
|
|
|
2019-08-25 21:45:52 +02:00
|
|
|
echo '<div class="maincontent">';
|
|
|
|
echo '<table border="0" cellpadding="0" cellspacing="0" summary="" width="100%">';
|
|
|
|
echo '<tr>';
|
2019-08-30 23:13:46 +02:00
|
|
|
echo '<td width="50%">';
|
|
|
|
echo 'Please wait ... (transforming)<hr>';
|
|
|
|
require_once 'inc/zeichen.php';
|
|
|
|
$filename = $_GET['fnam'];
|
|
|
|
$csv_datei = 'csv/' . $filename;
|
|
|
|
|
2019-09-01 19:54:01 +02:00
|
|
|
mkdir("xml", 0755);
|
2019-08-30 23:13:46 +02:00
|
|
|
$fp = fopen ( $csv_datei, 'r' );
|
|
|
|
$y = 0;
|
2019-09-01 19:54:01 +02:00
|
|
|
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
|
|
|
|
2019-08-30 23:13:46 +02:00
|
|
|
$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";
|
|
|
|
|
2019-09-01 19:54:01 +02:00
|
|
|
for ($x = 0; $x < count ($zeile); $x++) {
|
2019-08-30 23:13:46 +02:00
|
|
|
$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>';
|
2019-08-25 21:45:52 +02:00
|
|
|
echo '</tr>';
|
|
|
|
echo '</table>';
|
|
|
|
echo '</div>';
|
2019-09-01 19:54:01 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
';
|