do recommend! (Weiterempfehlung)

Wie verwendet man Module oder Aktion und passt diese an.

do recommend! (Weiterempfehlung)

Beitragvon melanie » 29. Okt 2008, 13:33

Hallo,

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
Ein CMS ist nur dann hervorragend, wenn es auch hervorragende Module hat.
Benutzeravatar
melanie
 
Beiträge: 29
Registriert: 16. Mär 2007, 16:57
Wohnort: 61169 Friedberg

Beitragvon Skerbis » 7. Jan 2009, 13:53

:arrow: Problem behoben in der aktuellen Version 1.0
Ein bisschen spät. Sorry.
----------------------
Werbeagentur KLXM Crossmedia
die Kommunikationsagentur vom linken Niederrhein
http://www.klxm.de
Skerbis
 
Beiträge: 889
Registriert: 4. Aug 2006, 13:06
Wohnort: Rheinberg

do recommend! captcha problem

Beitragvon Steffmeister » 29. Jan 2009, 11:36

Hi Leute,

habe das do recommend! Modul erfolgreich installiert. Captcha funktioniert nur nicht ganz rund! Es wird angezeigt, aber jedes mal wenn ich den Sicherheitscode eingebe ist er falsch und es liegt bestimmt nicht an meiner Rechtschreibung.

Würde mich sehr freuen wenn mir jemand helfen kann!

Grüße
Benutzeravatar
Steffmeister
 
Beiträge: 22
Registriert: 29. Jan 2009, 11:25
Wohnort: Nürnberg

Beitragvon Skerbis » 29. Jan 2009, 17:24

Hallo,
hast Du auch im Ausgabe-Template eine Session gestartet?
----------------------
Werbeagentur KLXM Crossmedia
die Kommunikationsagentur vom linken Niederrhein
http://www.klxm.de
Skerbis
 
Beiträge: 889
Registriert: 4. Aug 2006, 13:06
Wohnort: Rheinberg

Denke schon!

Beitragvon Steffmeister » 29. Jan 2009, 17:49

Hi,

habe das captcha template so wie es von dir ist als Template angelegt:

<?php
session_start();

// do captcha!
// Version 1.1
// Stand: 1.08.2008......
?>

Oder muss ich auch in dem Template eine Session starten in dem das do recommend! Modul ausgegeben wird? (Hatte glaube ich schon mal probiert)

Danke!
Benutzeravatar
Steffmeister
 
Beiträge: 22
Registriert: 29. Jan 2009, 11:25
Wohnort: Nürnberg

getestet

Beitragvon Steffmeister » 29. Jan 2009, 18:08

Hi,

habe gerade das Session Tag überhalb meines Quelltextes im Ausgabetemplate eingebunden. Funktioniert nicht, hat aber 2 Fehler ausgegeben:

1. im Firefox sagt er "no spam please"
2. im Safari sagt er "Method Not Allowed"

Komisch...

Danke!
Benutzeravatar
Steffmeister
 
Beiträge: 22
Registriert: 29. Jan 2009, 11:25
Wohnort: Nürnberg

Beitragvon netmanix » 29. Jan 2009, 21:04

Hallo und Willkommen bei Redaxo,

wenn Du die Captcha-Lösung von Skerbis einsetzen möchtest, musst Du die Session im Template des Captchas und im Template des verwendeten Moduls starten. (Als allererstes im Quellcode)

:!: Überlege aber gut darüber nach, ob Du wirklich eine Seite empfehlen Funktion auf Deinen Seiten einsetzen möchtest. Das kann rechtliche Folgen haben.
Benutzeravatar
netmanix
 
Beiträge: 292
Registriert: 11. Sep 2008, 19:35
Wohnort: Wesel

funzt trotzdem nicht!

Beitragvon Steffmeister » 29. Jan 2009, 22:34

Ich weiß nicht mehr weiter, denn es funktioniert wirklich nicht die Session hab ich schon überall eingefügt!

Hier mein Qeuellcode:

<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
</head>
<body>
<?php
print $this->getArticle(1);
?>
</body>
</html>

das ist eigentlich mein ganzes template!


Grüße

Stefan
Benutzeravatar
Steffmeister
 
Beiträge: 22
Registriert: 29. Jan 2009, 11:25
Wohnort: Nürnberg

Beitragvon netmanix » 29. Jan 2009, 22:57

Kommentiere das mal aus und prüfe ob es dann funktioniert.


Code: Alles auswählen
if (!spamcheck(array($_POST['friend_email1'],$subject,$_POST['friend_name1']))) {
      die('no spam please');
    } 
     


Diesen Spamcheck braucht man ja nicht unbedingt, wenn man ein captcha einsetzt.



P.S. Tolle Seite ... Tolles Angebot ... würde mich freuen Dich mal in der Nähe von Essen live zu sehen.
Benutzeravatar
netmanix
 
Beiträge: 292
Registriert: 11. Sep 2008, 19:35
Wohnort: Wesel

Problem gelöst

Beitragvon Steffmeister » 30. Jan 2009, 08:23

Hi,

super vielen Dank! Es funktioniert, toll!

Wenn ich mal in Essen bin sag ich bescheid ;-)

Gruß
Stefan
Benutzeravatar
Steffmeister
 
Beiträge: 22
Registriert: 29. Jan 2009, 11:25
Wohnort: Nürnberg

Beitragvon armin » 1. Okt 2009, 15:51

läuft doRecommend auf Redaxo 4.2? ich bekomme immer nur Fehlermeldungen im Backend…
armin
 
Beiträge: 4
Registriert: 29. Sep 2009, 17:29
Wohnort: Berlin

Beitragvon netmanix » 2. Okt 2009, 08:17

Nö. Kann auch nicht feststellen warum.
Ich erhalte überhaupt keine Fehlermeldungen.
Wenn ich das Modul ausgeben will, kann ich den Artikel nicht mehr pflegen, da die Ausgabe im Backend unterbrochen wird.

Schade. War ein tolles Modul.
Benutzeravatar
netmanix
 
Beiträge: 292
Registriert: 11. Sep 2008, 19:35
Wohnort: Wesel

Re: do recommend! (Weiterempfehlung)

Beitragvon svenalbert » 30. Jun 2011, 11:05

Bei mir läuft es unter 4.3 ohne Probleme - bei einer 4.2er Version habe ich es nicht eingesetzt.
Benutzeravatar
svenalbert
 
Beiträge: 1295
Registriert: 24. Nov 2005, 16:21
Wohnort: Clausthal-Zellerfeld / lower saxony


Zurück zu Module/Aktionen [R4]

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 4 Gäste

cron