ich nutze das Kontaktformular von Andreas Lindner (Standardmodul in Contenido 4.6.23).
Wie kann ich verhindern, dass HTML-Tags übermittelt werden? Also eine Eingabe wie "<u>Hallo</u>" soll nicht als "Hallo" in der Mail erscheinen sondern eben "<u>Hallo</u>".
Normalerweise können HTML-Tags ja mit htmlspecialchars() entschärft werden. Aber wo kann ich diese Funktion im Modul anwenden? Oder muss das über die class.phpmailer.php passieren?
Weiß einer Rat?


Vielen Dank für Infos!
Code: Alles auswählen
?><?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Contact form
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business
* Created : 12.08.2005
************************************************/
?>
<table border="0">
<tr>
<td><?php echo mi18n("Absender EMail");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[0]";?>" value="<?php echo "CMS_VALUE[0]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("Absender Name");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[2]";?>" value="<?php echo "CMS_VALUE[2]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("Empfänger EMail");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[1]";?>" value="<?php echo "CMS_VALUE[1]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("Betreff");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[3]";?>" value="<?php echo "CMS_VALUE[3]"; ?>"></td>
</tr>
<?php
$c1 = '';
$c2 = '';
$c3 = '';
$c4 = '';
switch (strtolower("CMS_VALUE[4]")) {
case "smtp" :
$c1 = ' checked';
break;
case "mail" :
$c2 = ' checked';
break;
case "sendmail" :
$c3 = ' checked';
break;
case "qmail" :
$c4 = ' checked';
break;
default :
$c3 = ' checked';
}
?>
<tr>
<td valign="top"><?php echo mi18n("Mailer");?></td>
<td>
<input type="radio" name="<?php echo "CMS_VAR[4]";?>" value="mail"<?php echo $c2;?>> <?php echo mi18n("mail");?><br/>
<input type="radio" name="<?php echo "CMS_VAR[4]";?>" value="qmail"<?php echo $c4;?>> <?php echo mi18n("qmail");?><br/>
<input type="radio" name="<?php echo "CMS_VAR[4]";?>" value="sendmail"<?php echo $c3;?>> <?php echo mi18n("sendmail");?><br/>
<input type="radio" name="<?php echo "CMS_VAR[4]";?>" value="smtp"<?php echo $c1;?>> <?php echo mi18n("smtp");?><br/>
</td>
</tr>
<tr>
<td><?php echo mi18n("SMTP Host");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[5]";?>" value="<?php echo "CMS_VALUE[5]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("SMTP User");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[6]";?>" value="<?php echo "CMS_VALUE[6]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("SMTP Passwort");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[7]";?>" value="<?php echo "CMS_VALUE[7]"; ?>"></td>
</tr>
</table>
<?php
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Contact form
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business
* Created : 12.08.2005
************************************************/
#Includes
cInclude("classes", "class.phpmailer.php");
if (!isset ($_POST['send'])) {
#Form has not been sent yet
cInclude('classes', 'class.article.php');
cInclude('classes', 'class.template.php');
#Create contact form
echo '<div class="kontaktformular"/>';
echo '<form name="kontaktform" id="kontaktform" method="post" action="'.$sess->url("front_content.php?idcat=$idcat&idart=$idart&parentid=$parentid").'">'."\n";
echo '<input type="hidden" name="send" value="1">';
if (!is_object($tpl)) {
$tpl = new Template;
}
$tpl->set("s", "NAME", mi18n("Name"));
/**** Weitere Formularfelder in diesem Posting gekürzt! ****/
$tpl->set("s", "PFLICHTFELDER", mi18n("Pflichtfelder"));
$tpl->set("s", "ABSCHICKEN", mi18n("Abschicken"));
$tpl->set("s", "LOESCHEN", mi18n("Löschen"));
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/kzm_formular.html");
echo '</form>';
echo '</div>';
} elseif ($_POST['send'] == 1) {
#Form has been sent
$mail = new phpmailer;
$mail_body = '<html><head></head><body bgcolor="#ffffff"><table cellspacing="0" cellpadding="2" border="0">';
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if ($key != 'send') {
$mail_body .= "<tr><td><b>$key</b></td><td>$value</td></tr>";
}
}
}
$mail_body .= '</table></bo'.'dy></html>';
$mail->Host = "localhost";
$mail->IsHTML(true);
#Get mailer from settings
switch (strtolower("CMS_VALUE[4]")) {
case "smtp" :
$mail->IsSMTP();
$host = "CMS_VALUE[5]";
$user = "CMS_VALUE[6]";
$password = "CMS_VALUE[7]";
if (($host != '') && ($user != '') && ($password != '')) {
$mail-> $SMTPAuth = true;
$mail->Host = $host;
$mail->Username = $user;
$mail->Password = $password;
}
break;
case "mail" :
$mail->IsMail();
break;
case "sendmail" :
$mail->IsSendmail();
break;
case "qmail" :
$mail->IsQmail();
break;
default :
}
// $mail->From = "CMS_VALUE[0]";
// $mail->FromName = "CMS_VALUE[2]";
$mail->From = $_POST['E-Mail'];
$mail->FromName = $_POST['Vorname']." ".$_POST['Nachname'];
$mail->AddAddress("CMS_VALUE[1]", "");
$mail->Subject = "CMS_VALUE[3]";
$mail->Body = $mail_body;
$mail->WordWrap = 50;
$mail->Send();
#Display message after mail is sent
echo mi18n("
<table class=text width=100%>
<tr>
<th class=text>
Sendebestätigung
</th>
</tr>
<tr>
<td class=text>
Vielen Dank für Ihre Mitteilung.</td>
</tr>
</table>")."<br/>";
}
?>