Add a lot of new fields with improved and more integrated checks for
dependencies and allowed values
This commit is contained in:
77
index4.php
77
index4.php
@ -1,27 +1,41 @@
|
||||
<?PHP
|
||||
//error_reporting(E_ALL);
|
||||
//ini_set('display_errors',1);
|
||||
$semikoma = $_GET['semikoma'];
|
||||
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">';
|
||||
echo '<table border="0" cellpadding="0" cellspacing="0" summary="" width="100%">';
|
||||
echo '<tr>';
|
||||
echo '<td width="50%">';
|
||||
echo 'Please wait ... (transforming)<hr>';
|
||||
ob_start();
|
||||
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; // für ungarn sonst weg //////////////////////
|
||||
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";
|
||||
|
||||
require 'inc/zeichen.php';
|
||||
$filename = $_GET['fnam'];
|
||||
$csv_datei = 'csv/' . $filename;
|
||||
|
||||
mkdir("xml", 0777);
|
||||
$fp = fopen ( $csv_datei, 'r' );
|
||||
if (is_dir(__DIR__ . "/xml")) rrmdir(__DIR__ . '/xml');
|
||||
mkdir("xml", 0755);
|
||||
|
||||
$fp = fopen ($csv_datei, 'r');
|
||||
$y = 0;
|
||||
while ( $zeile = fgetcsv ( $fp, 100000, ';' ) )
|
||||
{
|
||||
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||
|
||||
$y++;
|
||||
$zieldatei = 'xml/' . $y . '.xml';
|
||||
if (!$handle = fopen($zieldatei, 'w')) {
|
||||
@ -35,6 +49,7 @@ while ( $zeile = fgetcsv ( $fp, 100000, ';' ) )
|
||||
$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 (empty($inhalt[$y][$x])) continue;
|
||||
//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 }
|
||||
}
|
||||
@ -43,11 +58,25 @@ while ( $zeile = fgetcsv ( $fp, 100000, ';' ) )
|
||||
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>';
|
||||
echo '</div>';
|
||||
|
||||
echo printHTMLHead();
|
||||
|
||||
echo '
|
||||
<div>
|
||||
Please wait ... (transforming)
|
||||
<hr />
|
||||
|
||||
' . ($y - 1) . ' files created
|
||||
<br/>
|
||||
<a href="zipit.php"><img src="img/go.gif"> Download as zip</a>
|
||||
|
||||
</div>';
|
||||
|
||||
echo '
|
||||
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
Reference in New Issue
Block a user