habe das Weiterempfehlungsmodul do recommend eingebaut, es funktioniert auch, allerdings entsteht eine hässliche Fehlermeldung im Backend. Vielleicht entsteht sie, weil das doForm Formularmodul auf die gleichen Programmierungen zugreift.
Hier http://wiki.redaxo.de/index.php?n=R3.FA ... tredeclare steht, was ich machen muss, um diese Fehlermeldung zu unterdrücken.
Aber wo genau baue ich das in die Funktion ein? Sie besteht aus drei Teilen und aus der Captchafunktion. Mir ist es leider nicht gelungen. Folgenden Code muss ich irgendwo in die Modulausgabe hineinwürgen:
Code: Alles auswählen
// ###########################
if(!function_exists('doTellForm')) { function doTellForm() {
// ###########################
Hier kommt die Funktion rein
//###########################
} }
// ###########################
Dies ist die Modulausgabe des do recommend:
Code: Alles auswählen
<?
//---------------------------------------------
// do recommend!
// MODUL-AUSGABE
// Version 0.92 (2.52)
// Thomas Skerbis
//
// Stand: 25.08.2008
//----------------------------------------------
// Basierend auf: Tell A Friend von:
// Christian-web-masters.com
###### Adresse zum Captcha-Skript #################
###### Externe Einbindung eines Captchas ##########
$captchasource="/index.php?article_id=268&clang=0=0";
####################################################
// Formularplatzhalter allgemein :
# Sprache 0
if ($REX['CUR_CLANG']=="0")
{
$fAbsenderdaten="Absenderdaten";
$fAbsenderName="Ihr Name";
$fAbsenderEmail="Ihre E-Mail";
$fEmpfdaten="Empfängerdaten";
$fEmpfName="Empfängername";
$fEmpfEnmail="Empfänger E-Mail";
$fNachricht="Ihre Nachricht:";
$fSecinfo="Tragen Sie bitte den Spamschutzcode ein!";
$fSecName="Sicherheitscode";
}
# Sprache 1
if ($REX['CUR_CLANG']=="1")
{
$fAbsenderdaten="";
$fAbsenderName="";
$fAbsenderEmail="";
$fEmpfdaten="";
$fEmpfName="";
$fEmpfEnmail="";
$fNachricht="";
$fSecinfo="";
$fSecName="";
}
# Sprache 2
if ($REX['CUR_CLANG']=="2")
{
$fAbsenderdaten="";
$fAbsenderName="";
$fAbsenderEmail="";
$fEmpfdaten="";
$fEmpfName="";
$fEmpfEnmail="";
$fNachricht="";
$fSecinfo="";
$fSecName="";
}
// ************Begin Configure***************
//Put your website name between the quotes below:
$websiteName = "";
//Put your website address between the quotes below:
$websiteAddress = "";
// If you have a privacy policy, put in the link title:
$privacyPolicyLinkText = "";
// Put in the "" the url to you your privacy policy, if you have one,
$privacyPolicyLinkURL = "";
// Change the 0 to a 1 below,
//if you want to recieve a notice when people are refered:
if ("REX_VALUE[10]"=="")
{
$notice = 0;
}
else
{
$notice = 1;
}
//Put your email address in the " " if you changed the notice to 1
$adminEmail = "REX_VALUE[10]";
//Put the subject line text you want the email to read in the "":
$subject = "REX_VALUE[3]";
// Put your default message intro text in the first set of quotes below
//This is what the people who are referred will see
//along with any personal message entered by the referer.
$defaultMessageIntro = "REX_VALUE[4]" . "\n" ;
//Put in the "" your default close (this will be at the end of the message):
$defaultMessageClose = "REX_VALUE[5]";
#$defaultMessageClose = stripslashes($defaultMessageClose);
$defaultMessageClose = html_entity_decode($defaultMessageClose);
$defaultMessageClose = str_replace(array("<br />","<br />","<br>","</p><p>","<p>"),"",$defaultMessageClose);
#$defaultMessageClose = stripslashes($defaultMessageClose);
if (isset($_POST['friend_name1'])) {
$friendval = $_POST['friend_name1'] ;
}
else
{
$friendval="";
}
if (isset($_POST['friend_email1'])) {
$friendMailval = $_POST['friend_email1'] ;
}
else
{
$friendMailval="";
}
if (isset($_POST['your_email'])) {
$yourMailval = $_POST['your_email'] ;
}
else
{
$yourMailval="";
}
if (isset($_POST['your_name'])) {
$yourNameval = $_POST['your_name'] ;
}
else
{
$yourNameval="";
}
if (isset($_POST['message'])) {
$defaultMessageIntro = $_POST['message'] ;
}
else
{
$defaultMessageIntro = $defaultMessageIntro;
}
// ************End Configure****************
// Set the link that will be in intro/invite and used to send the referer back
if (isset($_POST['link'])) {
$link = $_POST['link'];
}
else {
if (empty($_SERVER['HTTP_REFERER'])) {
$link = 'http://' . $websiteAddress;
} else {
$link = $_SERVER['HTTP_REFERER'];
}
}
// Add the link to the intro
$defaultMessageIntro = $defaultMessageIntro . $link . "\n";
//Adds a space infront of the subject line (to add a name latter
$subject = ' ' . $subject;
?>
<?php
function doTellForm ($privacyPolicyLinkText, $privacyPolicyLinkURL, $defaultMessageIntro, $link, $friendval, $yourNameval, $yourMailval, $friendMailval, $fAbsenderdaten, $fAbsenderName, $fAbsenderEmail, $fEmpfdaten, $fEmpfName, $fEmpfEnmail, $fNachricht, $fSecinfo, $captchasource, $fSecName)
{
// If you understand HTML, you can make changes to the form layout below.
// I just copy the HTML from the "<form" opening to the "</form>"
// Put it into Dreamweaver (WYSIWYG Editor), work on it and put it back.
$theForm = <<<EOD
<form class="formgen" name="tellForm" method="post" action="">
<h2>$fAbsenderdaten</h2>
<div class="formblock">
<label for="your_name">$fAbsenderName:</label>
<input class="formtext" name="your_name" type="text" id="your_name" value="$yourNameval"/>
<label for="textfield"></label>
<br /><br />
<label for="your_email">$fAbsenderEmail:</label>
<input class="formtext" name="your_email" type="text" id="your_email" value="$yourMailval"/>
<br />
</div>
<h2>$fEmpfdaten</h2>
<div class="formblock">
<label for="friend_name1">$fEmpfName:</label>
<input class="formtext" name="friend_name1" value="$friendval" type="text" id="friend_name1"/>
<br />
<br />
<label for="friend_email1">$fEmpfEnmail:</label>
<input class="formtext" name="friend_email1" type="text" id="friend_email1" value="$friendMailval"/>
</div>
<input name="tellsubmit" type="hidden" id="tellsubmit4" value="doTheSend"/>
<input class="formtext" name="link" type="hidden" id="link" value="$link"/>
<h2>$fNachricht</h2>
<div class="formblock">
<textarea class="formtextfield" name="message" rows="10" id="textarea">$defaultMessageIntro</textarea>
</div>
<h2>$fSecinfo</h2>
<div class="formblock">
<img src="$captchasource" alt="Security-Code" class="formcaptcha" title="Security-Code" border="1" /><br>
<label for="seccode">$fSecName:</label>
<input class="formtext" name="seccode" type="text" id="seccode"/>
</div>
<br />
<div class="formblock">
<input class="formsubmit" type="submit" name="Submit" value="REX_VALUE[6]">
</div>
<div align="center">
</div>
</form>
EOD;
echo ($theForm);
}
?>
<?php
function spamcheck($array) {
# returns true if data is ok, otherwise false if it is spam-looking
return (!preg_match("/(MIME-Version:|Content-Type:|\n|\r)/i", join('',array_values($array)) ));
}
function doTell ($notice, $adminEmail, $subject, $websiteName, $defaultMessageClose, $link)
{
//Create a new mail object. You'll get an error here is the right files are not required
//at the top of this script.
$mail = new rex_mailer();
$mail->CharSet = "utf-8";
//If the site visitor entered thier email on the form,
//then the mail sent will come from them.
if ($_POST['your_email'] != "")
{
$mail->From = $_POST['your_email'];
$mail->FromName = $_POST['your_name'];
}
//If not, the email will come from your admin email address.
else
{
$mail->From = $adminEmail;
$mail->FromName = $websiteName;
}
if ($_POST['friend_email1'] != "")
{
// Check for suspected spam content
if (!spamcheck(array($_POST['friend_email1'],$subject,$_POST['friend_name1']))) {
die('no spam please');
}
//This takes the email address and name from form variables
$mail->AddAddress($_POST['friend_email1'], $_POST['friend_name1']);
//This tacs the name onto the subject line
$subject = str_replace("%Name%", $_POST['friend_name1'], "REX_VALUE[3]");
$subject = str_replace("%Absender%", $_POST['your_name'], $subject);
$mail->Subject = $subject;
//This tacs the name onto the message
$defaultMessageClose = str_replace("%Name%", $_POST['friend_name1'], $defaultMessageClose);
$defaultMessageClose= str_replace("%Absender%", $_POST['your_name'], $defaultMessageClose);
$mail->Body = $_POST['friend_name1'] . "\r\n" . $_POST['message']
. "\n\n" . $defaultMessageClose;
//If you kept the notice set to 1, then this will Blind Copy you on the email.
if ($notice == 1)
{
$mail->AddBCC ($adminEmail, 'Referal notice');
}
//If the mail does not send...
if(!$mail->Send())
{
// This echo's the error message if the email did not send.
// You could change the text in between the <p> tags.
echo('<p>Mail could not be sent to '
. $_POST['friend_email1'] . ' Please use your back button to try them again.</p>');
}
//If the mail does send...
else
{
$oktext = str_replace("%email%", $_POST['friend_email1'], "REX_VALUE[7]");
echo "<p><strong>$oktext</strong></p>";
#echo ('<p>REX_VALUE[7]</p>');
}
// Clear all addresses and attachments for the next one
$mail->ClearAddresses();
}
if ($_POST['friend_email2'] != "")
{
// Check for suspected spam content
if (!spamcheck(array($_POST['friend_email3'],$subject,$_POST['friend_name3']))) {
die('no spam please');
}
//This takes the email address and name from form variables
$mail->AddAddress($_POST['friend_email2'], $_POST['friend_name2']);
//This tacs the name onto the subject line
$mail->Subject = $_POST['friend_name2'] . $subject;
//This tacs the name onto the message
$mail->Body = $_POST['friend_name2'] . "\r\n" . $_POST['message']
. "\n\n" . $defaultMessageClose;
//If you kept the notice set to 1, then this will Blind Copy you on the email.
if ($notice == 1)
{
$mail->AddBCC ($adminEmail, 'Referal notice');
}
//If the mail does not send...
if(!$mail->Send())
{
// This echo's the error message if the email did not send.
// You could change the text in between the <p> tags.
echo('<p>Mail could not be sent to '
. $_POST['friend_email2'] . ' Please use your back button to try them again.</p>');
}
//If the mail does send...
else
{
echo ('<p>Your message was successfully sent to ' . $_POST['friend_email2'] . '</p>');
}
// Clear all addresses and attachments for the next one
$mail->ClearAddresses();
}
if ($_POST['friend_email3'] != "")
{
// Check for suspected spam content
if (!spamcheck(array($_POST['friend_email3'],$subject,$_POST['friend_name3']))) {
die('no spam please');
}
//This takes the email address and name from form variables
$mail->AddAddress($_POST['friend_email3'], $_POST['friend_name3']);
//This tacs the name onto the subject line
$mail->Subject = $_POST['friend_name3'] . $subject;
//This tacs the name onto the message
$mail->Body = $_POST['friend_name3'] . "\r\n" . $_POST['message']
. "\n\n" . $defaultMessageClose;
//If you kept the notice set to 1, then this will Blind Copy you on the email.
if ($notice == 1)
{
$mail->AddBCC ($adminEmail, 'Referal notice');
}
//If the mail does not send...
if(!$mail->Send())
{
// This echo's the error message if the email did not send.
// You could change the text in between the <p> tags.
echo('<p>Mail could not be sent to '
. $_POST['friend_email3'] . ' Please use your back button to try them again.</p>');
}
//If the mail does send...
else
{
echo ('<p>REX_VALUE[7]</p>');
#echo ('<p>Your message was successfully sent to ' . $_POST['friend_email3'] . '</p>');
}
// Clear all addresses and attachments for the next one
$mail->ClearAddresses();
}
$returntext="REX_VALUE[8]";
$return = <<<EOD
<p align="center"><a href="$link">REX_VALUE[8]</a></p>
EOD;
echo ($return);
}
if (isset($_POST['tellsubmit']))
{
if ($_SESSION["kcode"]==$_POST['seccode'] )
{doTell($notice, $adminEmail, $subject, $websiteName, $defaultMessageClose, $link);unset($_SESSION["clink"]);unset($_SESSION["kcode"]);;
}
else
{
echo "<h2>Achtung!</h2><div class='forminfo'><strong>REX_VALUE[9]</strong></div><br /><br />";
$_SESSION["clink"]="no";
$defaultMessageIntro = $_POST['message'];
doTellForm($privacyPolicyLinkText, $privacyPolicyLinkURL, $defaultMessageIntro, $link, $friendval, $yourNameval, $yourMailval, $friendMailval, $fAbsenderdaten, $fAbsenderName, $fAbsenderEmail, $fEmpfdaten, $fEmpfName, $fEmpfEnmail, $fNachricht, $fSecinfo, $captchasource, $fSecName); }
}
else {
doTellForm($privacyPolicyLinkText, $privacyPolicyLinkURL, $defaultMessageIntro, $link, $friendval, $yourNameval, $yourMailval, $friendMailval,$fAbsenderdaten, $fAbsenderName, $fAbsenderEmail, $fEmpfdaten, $fEmpfName, $fEmpfEnmail, $fNachricht, $fSecinfo, $captchasource,$fSecName);
}
?>
Vielen lieben Dank für Eure Hilfe!
LG.
Melanie