fix: system message can contain quotes and no longer inserts BOM

This commit is contained in:
Martin Ambrus
2017-10-20 01:31:58 +02:00
parent 33143e9405
commit f46b94b832
3 changed files with 13 additions and 31 deletions
+4 -2
View File
@@ -40,8 +40,10 @@ if (@isset($_POST['confirm']))
$myFile = "Templates/text.tpl";
$fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: templates/text.tpl");
$text = file_get_contents("Templates/text_format.tpl");
$text = preg_replace("'%TEKST%'",$_SESSION['m_message'] ,$text);
$text = utf8_encode($text);
$text = preg_replace("'%TEKST%'",str_replace('"', '\\"', $_SESSION['m_message']) ,$text);
// the following is not really needed and results in fhe file starting with BOM which gets displayed when the message is shown
// ... also, this very much depends on the underlying system and utf8_encode() is only good if the system is defaulted to ISO-8859-1
// $text = utf8_encode($text);
fwrite($fh, $text);
$query="SELECT * FROM ".TB_PREFIX."users ORDER BY id + 0 DESC";