Files
gutachten_t3/packages/gutachten/Resources/Private/data/html_decode.php
T

75 lines
2.6 KiB
PHP

#!/usr/bin/php
<?php
/***
ÄNDERUNGEN
Status moves to "uebersicht" as field "status"
*/
ini_set('memory_limit', '512M');
// $file = file_get_contents("testing.sql");
// echo "----------\n";
// echo $file;
// // $file = file_get_contents("web272_db1_2017-12-03.sql");
//
// $file = html_entity_decode($file, ENT_HTML401);
// $file = convert_to($file, "UTF8");
//
// echo "----------\n";
// echo $file;
// exit;
$file = file_get_contents("web272_db1_2017-12-03.sql");
$file = html_entity_decode($file, ENT_HTML401);
// allen tabellen "tx_gutachten_" vorstellen wo fehlt.
$file = str_replace("`auftraggeber`","`tx_gutachten_auftraggeber`", $file );
$file = str_replace("`downloadlog`","`tx_gutachten_downloadlog`", $file );
$file = str_replace("`freigabe`","`tx_gutachten_freigabe`", $file );
$file = str_replace("`gutachter`","`tx_gutachten_gutachter`", $file );
$file = str_replace("`projekteplatzhalter`","`tx_gutachten_projekteplatzhalter`", $file );
$file = str_replace("`projektestandards`","`tx_gutachten_projektestandards`", $file );
$file = str_replace("`standards`","`tx_gutachten_standards`", $file );
$file = str_replace("`textart`","`tx_gutachten_textart`", $file );
$file = str_replace("`uebersicht`","`tx_gutachten_uebersicht`", $file );
$file = str_replace("CHARACTER SET latin1","", $file );
$file = str_replace("latin1_german1_ci","utf8_unicode_ci", $file );
$file = str_replace("latin1_german2_ci","utf8_unicode_ci", $file );
$file = str_replace("latin1","utf8", $file );
$file = str_replace("ENGINE=MyISAM","ENGINE=InnoDB", $file );
$file = convert_to($file, "UTF8");
file_put_contents("testing_converted.sql", $file);
$sql = "ALTER TABLE `tx_gutachten_uebersicht` ADD `status` TINYINT(4) NULL DEFAULT '1' AFTER `loggia_title`";
$sql = "update tx_gutachten_uebersicht a, tx_gutachten_freigabe b set a.status=b.status where a.uebersicht_id=b.pid";
function convert_to( $source, $target_encoding )
{
// detect the character encoding of the incoming file
$encoding = mb_detect_encoding( $source, "auto" );
// escape all of the question marks so we can remove artifacts from
// the unicode conversion process
$target = str_replace( "?", "[question_mark]", $source );
// convert the string to the target encoding
$target = mb_convert_encoding( $target, $target_encoding, $encoding);
// remove any question marks that have been introduced because of illegal characters
$target = str_replace( "?", "", $target );
// replace the token string "[question_mark]" with the symbol "?"
$target = str_replace( "[question_mark]", "?", $target );
return $target;
}
?>