Formulargenerator

Alles rund um Module und Plugins in CONTENIDO 4.9.
McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mi 1. Mär 2017, 23:50

N'Abend!

Ich hab mich dann mal durchgebissen :mrgreen:

...und tatsächlich den Versand von Mails inkl. Dateianhang per mail() zum Laufen gebracht! Dazu habe ich den Aufbau der Mail-Header & Co. komplett neu zusammengestellt und dabei die Ausgabepufferung genutzt. Ist nicht auf meinem Mist gewachsen, da sei ehrenwerterweise http://webcheatsheet.com/php/send_email ... chment.php als Grundlage genannt. In Codezeilen ausgedrückt bedeutete das, den alten Teil

Code: Alles auswählen

/*##############################################*/
/*########## sending mail and displaying mailed data begin ##########*/
/*#############################################*/
/********** sending mail begin **********/
if($form_submitted!="" AND $no_errors=="true")
  {
  $ip = htmlspecialchars(strip_tags($_SERVER["REMOTE_ADDR"]));
  if($gender=="female") $gender_mail=mi18n("output email female");
    else $gender_mail=mi18n("output email male");
  //building array with recipients
  $recipients = "CMS_VALUE[100]";
  $array_recipients=array_filter(explode("//",$recipients));
  $recipients_in_array=explode("//",$recipients);
  //formatting subject of email
  $mail_subject="CMS_VALUE[200]";
  $mail_subject_variables="CMS_VALUE[210]";
  if($mail_subject_variables!="")
    {
    $array_mail_subject_variables=explode("###",$mail_subject_variables);
    foreach($array_mail_subject_variables AS $subject_variable) $mail_subject.=utf8_decode(' '.${$subject_variable});
    }
  // mail_body ist build within checking for errors section
  if($send_from_name!="" AND $send_from_email!="")
    {
	$name=$send_from_name;
	$email=$send_from_email;
	}
  $mail_header="From: ".$name." <".$email.">\n";
  $mail_header.="X-Sender-IP: ".$ip."\n";
  if($filetype=="")
  {
  $encoding = mb_detect_encoding($mail_body, "utf-8, iso-8859-1, cp-1252");
  $mail_header.="Content-Type: text/html;charset=".$encoding."\n";
  $mail_header.=nl2br($mail_body)."\n";
  $filename="";
  }
  else
    {
   $filename=$_FILES['attachment']['name'];
   if (isset($_FILES['attachment']['name']) && trim($_FILES['attachment']['name']) != "")
      {
      // Datei einlesen und codieren:
      $file_contenta=fread(fopen($_FILES['attachment']['tmp_name'],"r"),filesize($_FILES['attachment']['tmp_name']));
      $file_content=chunk_split((base64_encode($file_contenta)),72,"\n");
      // Boundary festlegen:
      $boundary=md5(uniqid(rand()));
      // Mail-Header:
      $mail_header.="MIME-Version: 1.0\n";
      $mail_header.="Content-Type: multipart/mixed;boundary=".$boundary."\n";
      $mail_header.="This is a multi-part message in MIME format.\n";
      // Mail-Text:
      $mail_header.="--".$boundary."\n";
      $encoding = mb_detect_encoding($mail_body, "utf-8, iso-8859-1, cp-1252");
      $mail_header.="Content-Type: text/html;charset=".$encoding."\n";
      $mail_header.=nl2br($mail_body)."\n";
      // Attachment:
      $mail_header.="--".$boundary."\n";
      $mail_header.="Content-Disposition: attachment;filename=".$_FILES['attachment']['name']."\n";
      $mail_header.="Content-Transfer-Encoding: base64\n";
      $mail_header.="Content-Type: ".$_FILES['attachment']['type'].";name=".$_FILES['attachment']['name']."\n";
      $mail_header.=$file_content;
      // Ende:
      $mail_header.="--".$boundary."--";
     }   
    }
  foreach($recipients_in_array as $recipient)
    {
    if (@mail($recipient,$mail_subject,"",$mail_header)) $sent = true;
      else echo "<br/>keine Verbindung zum Mailserver - bitte nochmal versuchen";
    }
/********** sending mail end **********/
/********** displaying mailed data begin **********/
  echo '<p>'.mi18n("output form following information was mailed").'</p>';
  echo $success_info; // build within checking for errors section
/********** displaying mailed data end **********/
  }
/*############################################*/
/*########## sending mail and displaying mailed data end ##########*/
/*############################################*/
?>
zu ersetzen mit

Code: Alles auswählen

/*##############################################*/
/*########## sending mail and displaying mailed data begin ##########*/
/*#############################################*/
/********** sending mail begin **********/
if($form_submitted!="" AND $no_errors=="true")
  {
  $ip = htmlspecialchars(strip_tags($_SERVER["REMOTE_ADDR"]));
  if($gender=="female") $gender_mail=mi18n("output email female");
    else $gender_mail=mi18n("output email male");
  //building array with recipients
  $recipients = "CMS_VALUE[100]";
  $array_recipients=array_filter(explode("//",$recipients));
  $recipients_in_array=explode("//",$recipients);
  //formatting subject of email
  $mail_subject="CMS_VALUE[200]";
  $mail_subject_variables="CMS_VALUE[210]";
  if($mail_subject_variables!="")
    {
    $array_mail_subject_variables=explode("###",$mail_subject_variables);
    foreach($array_mail_subject_variables AS $subject_variable) $mail_subject.=utf8_decode(' '.${$subject_variable});
    }
  // mail_body ist build within checking for errors section
  if($send_from_name!="" AND $send_from_email!="")
    {
	$name=$send_from_name;
	$email=$send_from_email;
	}
  if($filetype=="")
  {
$random_hash = md5(date('r', time()));
$headers = "From: ".$send_from_email."\r\nReply-To: ".$send_from_email;
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
ob_start(); //Turn on output buffering, IMPORTANT: DO NOT REMOVE ANY OF THE FOLLOWING EMPTY LINES OR ADD BLANKSPACES BEFORE THE CODELINES TILL $message = ob_get_clean();!!! OTHERWISE THE CODE WON'T WORK BECAUSE OF WRONG BUFFER-CONTENTS!!!
?>
--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo $mail_body_plain_text."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo nl2br($mail_body)."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?>--
<?php
$message = ob_get_clean();//copy current buffer contents into $message variable and delete current output buffer
  }
  else
    {
$random_hash = md5(date('r', time()));
$headers = "From: ".$send_from_email."\r\nReply-To: ".$send_from_email;
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['attachment']['tmp_name'])));
ob_start();  //Turn on output buffering, IMPORTANT: DO NOT REMOVE ANY OF THE FOLLOWING EMPTY LINES OR ADD BLANKSPACES BEFORE THE CODELINES TILL $message = ob_get_clean();!!! OTHERWISE THE CODE WON'T WORK BECAUSE OF WRONG BUFFER-CONTENTS!!!
?>
--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo $mail_body_plain_text."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo nl2br($mail_body)."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?>--

--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: <?php echo $_FILES['attachment']['type']; ?>; name="<?php echo $_FILES['attachment']['name']; ?>"
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--

<?php
$message = ob_get_clean();//copy current buffer contents into $message variable and delete current output buffer
    }
  foreach($recipients_in_array as $recipient)
    {
    if (@mail($recipient,$mail_subject,$message,$headers)) $sent = true;
      else echo "<br/>keine Verbindung zum Mailserver - bitte nochmal versuchen";
    }
/********** sending mail end **********/
/********** displaying mailed data begin **********/
  echo '<p>'.mi18n("output form following information was mailed").'</p>';
  echo $success_info; // build within checking for errors section
/********** displaying mailed data end **********/
  }
/*############################################*/
/*########## sending mail and displaying mailed data end ##########*/
/*############################################*/
?>
Wichtig ist dabei, dass es "während des Bufferings" extrem auf Leerzeichen und -zeilen ankommt. Insofern auf keinen Fall zwischen ob_start(); und $message = ob_get_clean(); Leerzeichen oder Tabs zum Einrücken verwenden und auch keine Leerzeilen entfernen. Sonst funktioniert's nicht.

Zusätzlich bietet der Versand noch eine plain-text-Version. Die Inhalte hierfür werden "weiter oben" im Quelltext zusammengestellt. Die Zeilen erwähne ich hier nicht, denn die Modul-Ausgabe im Eröffnungspost ist - wie immer - auf dem neuesten Stand und kann entsprechend 1 zu 1 in Gänze ausgetauscht werden - vorher aber bitte ggf. erfolgte eigene Anpassungen notieren... :wink:
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Do 2. Mär 2017, 20:51

Weil ich grad so schön dran war... bin ich auch gleich das Thema Responsivität noch mal angegangen. Der Aufbau des Formulars und der Übersicht nach Versand des Formulars basierte bisher auf Tabellen, was ich jetzt auf ein <div>-Konstrukt umgestellt habe. In der Mobilansicht führt das dazu, dass die Feldbezeichner nicht mehr links neben den Eingabefeldern sondern darüber platziert sind.

Wie immer: Die Quelltexte im Ausgangspost sind auf dem neuesten Stand. :D
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

Freddy
Beiträge: 252
Registriert: Fr 6. Mai 2005, 21:01
Wohnort: Gummersbach
Kontaktdaten:

Re: Formulargenerator

Beitrag von Freddy » Mo 9. Okt 2017, 17:25

Hallo,
hab gerade ein großes Problem beim Kontaktformular festgestellt.
Wenn ich ein Zeilenumbruch im Nachrichtentext eingeben dann kommt die Fehlermeldung "keine Verbindung zum Mailserver - bitte nochmal versuchen"
Das heißt, dass höchstwahrscheinlich viele Kontaktanfragen nicht angekommen sind. Kann mir jemand helfen bzw. kann es vermuten wo das Problem ist.Es ist sehr dringend da die Kontaktformulare online sind.

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mo 9. Okt 2017, 20:40

Hi,

An welche Mailadresse soll die Nachricht geschickt werden?
Viele Provider erlauben nur den Versand an Adressen, die auf die Domain lauten. Eine Nachricht an peter@meinedomain.de funktioniert dann, während peter@gmx.de nicht klappt.

Mit den Zeilenumbrüchen ist mir noch nicht untergekommen...

Habe es gerade auf einer Website getestet, die das Modul im Einsatz hat und konnte das Problem nicht nachstellen.

Edit: Im Backend Deiner Seite die neueste Version als neues Modul in neuer Vorlage in Testartikel eingebunden. Test im Frontend ergab keine Fehlermeldung. Schau mal bitte, ob bei der hinterlegten Mailadresse jetzt beide Nachrichten angekommen sind.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Do 31. Mai 2018, 15:20

Hallo zusammen,

ich habe das Modul um die Möglichkeit erweitert, die Mails nicht nur per mail() sondern auch SMTP zu versenden. Alle Anpassungen sind im Eröffnungspost eingearbeitet.

VG

Markus
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mi 24. Okt 2018, 19:06

Hallo zusammen,

weitere kleine Verbesserungen sind eingezogen:

EDIT 23.10.2018: Support von zusätzlichen CSS-Klassen für den Typ separator hinzugefügt. So lassen sich z. B. Hintergrundbilder usw. umsetzen. Desweiteren sind jetzt bei den types text und number leere fieldnames erlaubt.

Wie gehabt, sind die Quelltexte im Eröffnungspost entsprechend angepasst.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Di 19. Feb 2019, 21:41

Hallo zusammen,

eine weitere kleine Verbesserung ist umgsetzt:

EDIT 19.02.2019: Input-Felder sind jetzt mit mit einem <label> versehen und HTML5-Funktionen (Validierung, Fehlermeldung, Datepicker, …) aktivierbar. Der Eingabetyp "range" ist hinzugekommen.

Wie gehabt, sind die Quelltexte im Eröffnungspost entsprechend angepasst.
Zuletzt geändert von McHubi am Mi 20. Feb 2019, 01:04, insgesamt 1-mal geändert.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mi 20. Feb 2019, 00:48

Modul-Eingabe
Stand: 26.02.2019

Code: Alles auswählen

/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname   :     form_generator_sd
* Author(s)   :     Seamless-Design Markus Hübner
* Copyright   :     Markus Hübner
* Created     :     08/2014
* modified    :     03/2016: added separator
* modified    :     07/2016: added variables to subject
* modified    :     01/2017: added variables send_from_... to counter restrictions of some hosters with sending mails
* modified    :     03/2017: fixed attachment-bug / added plain-text version / improved responsive design
* modified    :     05/2018: added support for html-tags within description of formfields
* modified    :     05/2018: added support for smtp
* modified    :     10/2018: added support for css-class within separator and empty fieldnames for some types
* modified    :     02/2019: added labels for input-fields, html5 functionality, new type_range, configurable frontend success note and paging
************************************************/

echo '<table>';
echo '<tr><td>'.mi18n("input recipients").'</td><td><input size="100" type="text" name="CMS_VAR[100]" value="CMS_VALUE[100]"><br/>
<small>'.mi18n("input recipients hint").' -> //test@test.de</small></td></tr>';
echo '<tr><td>'.mi18n("input email subject").'</td><td><input size="100" type="text" name="CMS_VAR[200]" value="CMS_VALUE[200]"><br/>
      <small>'.mi18n("input email subject hint").'</small></td></tr>';
echo '<tr><td>'.mi18n("input email subject variables").'</td><td><input size="100" type="text" name="CMS_VAR[210]" value="CMS_VALUE[210]"><br/>
      <small>'.mi18n("input email subject variables hint").': gender###prename###name</small></td></tr>';
echo '<tr><td>'.mi18n("input attachment allowed").'</td><td>';
      if ("CMS_VALUE[300]" != "true") {
        echo '<input type="radio" name="CMS_VAR[300]" value="true"> '.mi18n("yes");
        } else {
        echo '<input type="radio" name="CMS_VAR[300]" value="true" checked>  '.mi18n("yes");
        }
      if ("CMS_VALUE[300]" != "false") {
        echo '<input type="radio" name="CMS_VAR[300]" value="false">  '.mi18n("no");
        } else {
        echo '<input type="radio" name="CMS_VAR[300]" value="false" checked>  '.mi18n("no");
        }
echo '</td></tr>';
echo '<tr><td>'.mi18n("input filesize max").'</td><td><input size="8" type="text" name="CMS_VAR[400]" value="CMS_VALUE[400]">'.mi18n("input filesize max hint").'</td></tr>';
echo '<tr><td>'.mi18n("input anti_spam active").'</td><td>';
      if ("CMS_VALUE[500]" != "true") {
        echo '<input type="radio" name="CMS_VAR[500]" value="true"> '.mi18n("yes");
        } else {
        echo '<input type="radio" name="CMS_VAR[500]" value="true" checked> '.mi18n("yes");
        }
      if ("CMS_VALUE[500]" != "false") {
        echo '<input type="radio" name="CMS_VAR[500]" value="false"> '.mi18n("no");
        } else {
        echo '<input type="radio" name="CMS_VAR[500]" value="false" checked> '.mi18n("no");
        }
echo '</td></tr>';
echo '<tr><td>'.mi18n("input activate html5 functions").'</td><td>';
      if ("CMS_VALUE[700]" != "true") {
        echo '<input type="radio" name="CMS_VAR[700]" value="true"> '.mi18n("yes");
        } else {
        echo '<input type="radio" name="CMS_VAR[700]" value="true" checked>  '.mi18n("yes");
        }
      if ("CMS_VALUE[700]" != "false") {
        echo '<input type="radio" name="CMS_VAR[700]" value="false">  '.mi18n("no");
        } else {
        echo '<input type="radio" name="CMS_VAR[700]" value="false" checked>  '.mi18n("no");
        }
echo '</td></tr>';
echo '<tr><td>'.mi18n("input activate page step info").'</td><td>';
      if ("CMS_VALUE[800]" != "true") {
        echo '<input type="radio" name="CMS_VAR[800]" value="true"> '.mi18n("yes");
        } else {
        echo '<input type="radio" name="CMS_VAR[800]" value="true" checked>  '.mi18n("yes");
        }
      if ("CMS_VALUE[800]" != "false") {
        echo '<input type="radio" name="CMS_VAR[800]" value="false">  '.mi18n("no");
        } else {
        echo '<input type="radio" name="CMS_VAR[800]" value="false" checked>  '.mi18n("no");
        }
echo '</td></tr>';
echo '<tr><td>'.mi18n("input activate data in success note").'</td><td>';
      if ("CMS_VALUE[900]" != "true") {
        echo '<input type="radio" name="CMS_VAR[900]" value="true"> '.mi18n("yes");
        } else {
        echo '<input type="radio" name="CMS_VAR[900]" value="true" checked>  '.mi18n("yes");
        }
      if ("CMS_VALUE[900]" != "false") {
        echo '<input type="radio" name="CMS_VAR[900]" value="false">  '.mi18n("no");
        } else {
        echo '<input type="radio" name="CMS_VAR[900]" value="false" checked>  '.mi18n("no");
        }
echo '</td></tr>';
echo '<tr><td colspan="2"><b>'.mi18n("input form fields").'</b></td></tr>';
echo '<tr><td colspan="2"><textarea style="font-size: 12px;font-family: arial,helvetica,sans-serif;" cols="200" rows="20" name="CMS_VAR[600]">CMS_VALUE[600]</textarea><br/>
     '.mi18n("input please save content in case of accidentally deleting it").'</td></tr>';
echo '<tr><td colspan="2" style="background-color: #f2f2f2;">
      <span style="font-weight: 900; font-size: 1.2em;">'.mi18n("input explanations").':</span><br/>
      <b>Definition einzelner Formularfelder</b><br/>
      ###type***fieldname***mandatory***name***class***value***size***description***additional***error message<br/>
      <br/>
      <u>###:</u> trennt die Formularfelderkonfigurationen<br/>
      <u>***:</u> trennt die Konfigurationselemente<br/>
      <u>+++:</u> trennt Formularfeldauswahlmöglichkeiten (nur bei type_radio, type_checkbox, type_select_single, type_select_multi)<br/>
      <ol>
      <li><u>type:</u> type_radio, type_checkbox, type_text, type_date, type_number, type_email, type_password, type_textarea, type_select_single, type_select_multi, type_file, type_separator</li>
      <li><u>fieldname:</u> Bezeichnung des Feldes, was ausgefüllt werden soll. Bei einigen kann er durch Festlegung von "none" entfallen falls er nicht benötigt wird.</li>
      <li><u>mandatory:</u> Pflichtfeld oder nicht? Per "true" oder "false" festzulegen.</li>
      <li><u>name:</u> Generell: Name der Variable, in der die Information gespeichert werden soll. Wichtig ist, ihn nur ein einziges Mal im gesamten Formular zu vergeben! Ausnahme Dateianhang (type_file): Hier muss der Name zwingend "attachment" lauten und kann nicht frei vergeben werden.</li>
      <li><u>class:</u> Für die individuelle Gestaltung kann hier eine CSS-Klasse eingetragen werden. Ist keine gewünscht oder vorhanden, "none" eintragen.</li>
      <li><u>value:</u> Wird benötigt für type_radio, type_checkbox, type_select_single, type_select_multi. Bei allen anderen "none" verwenden. Die "Bitte wählen"-Aufforderung für type_select_single und type_select_multi muss zwingend "--- ? ---" lauten (anderenfalls Modulausgabe anpassen).</li>
      <li><u>size:</u> type_textarea: Anzahl Zeilen x Breite in Prozent (z.B. 20x90)/ type_select_single und type_select_multi: Zeilen (z.B. 5)/ type_text, type_number, type_date, type_email, type_password: Prozentangabe der Breite (z.B. 50)</li>
      <li><u>description:</u> Erläuterungen zum Formularfeld, die über dem Eingabefeld erscheinen. Wenn nicht gewünscht, "none" eintragen.</li>
      <li><u>additional:</u> type_radio und type_checkbox: "horizontal" oder "vertical", type_number: min-max (z.B. 1000|2000) oder "none", alle anderen "none", type_range und type_page_end werden weiter unten erläutert.</li>
      <li><u>error message:</u> Fehlermeldung wenn ein Pflichtfeld nicht ausgefüllt wurde bzw. eine Angabe nicht korrekt ist.</li>
      </ol>
     <ul>
     <li><u>type_file:</u> Aktuell ist nur ein Dateianhang möglich.</li>
     <li><u>type_range:</u> Wenn der Schieberegler als Pflichtfeld gesetzt wird, kann der Minimalwert der akzeptiert wird in "6. value" festgelegt werden. Mit "7. size" kann der Minimalwert, Maximalwert, Schrittweite, Startwert und die Breite des Reglers (Prozentangabe) in genau dieser Reihenfolge, getrennt mit einem "|" festgelegt werden. In "9. additional" können tickmarks gesetzt werden, was jedoch aktuell nur von wenigen Webbrowsern unterstützt wird.</li>
     <li><u>type_page_begin:</u> Mit "2. fieldname" kann eine Seitenüberschrift festgelegt werden und unter "6. value" wird die Seitennummer vergeben. Letzteres ist zwingend notwendig und muss mit ganzen Zahlen erfolgen (1,2,3,...,10,11,...).</li>
     <li><u>type_page_end:</u> Jede Seite braucht einen Anfang und auch das Ende muss definiert werden. Unter "6. value" wird wieder die Seitennummer aus type_page_begin eingetragen. Unter "8. additional" wird die Beschriftung für die zurück- und weiter-Buttons festgelegt, getrennt mit einem "|". Da auf Seite 1 kein zurück-Schritt möglich ist, wird als Beschriftung "-" eingetragen. Der Button wird daraufhin nicht dargestellt. Ähnliches gilt für die letzte Formularseite, wo es keinen weiter-Button geben darf. Buttonbeschriftungen sehen für ein dreiseitiges Formular so aus: 1. "-|weiter", 2. "zurück|weiter", 3. "zurück|-".</li>
      </ul>
     <br/>
     <b>'.mi18n("input examples").'</b>
     <div style="border: 1px solid #999999;">
     ###type_page_begin***Seitentitel***false***none***none***1***none***none***none***none<br/>
###type_radio***Anrede***true***gender***none***Herr***none***Herr***vertical***Bitte teilen Sie Ihre Anrede mit.<br/>
+++type_radio***Anrede***true***gender***none***Frau***none***Frau***vertical***Bitte teilen Sie Ihre Anrede mit.<br/>
###type_checkbox***Wetter***true***sonne***none***Sonne scheint***none***Sonne scheint***vertical***Bitte sagen Sie, dass die Sonne scheint.<br/>
+++type_checkbox***Wetter***true***wind***none***Wind weht ein wenig***none***Wind weht ein wenig***vertical***Bitte sagen Sie, dass der Wind weht.<br/>
###type_page_end***none***false***none***none***1***none***none***-|weiter***none<br/>
###type_page_begin***Seitentitel***false***none***none***2***none***none***none***none<br/>
###type_text***Name***true***name***text***none***none***none***none***Bitte tragen Sie Ihren Namen ein.<br/>
###type_date***Datum***true***datum***text***none***20***none***none***Bitte tragen Sie ein korrektes Datum ein.<br/>
###type_email***E-Mail***true***email***text***none***none***none***none***Bitte tragen Sie eine korrekte E-Mail Adresse ein.<br/>
###type_password***Passwort***true***password***text***none***none***none***none***Bitte tragen Sie ein korrektes Passwort, dass den Kriterien ... entspricht ein.<br/>
###type_number***Postleitzahl***true***plz***text***none***30***none***1000|99999***Bitte geben Sie eine korrekte Postleitzahl ein.<br/>
###type_page_end***none***false***none***none***2***none***none***zurück|weiter***none<br/>
###type_page_begin***Seitentitel***false***none***none***3***none***none***none***none<br/>
###type_textarea***Nachricht***true***message***textarea***none***10x90***Lorem ipsum dolor...***none***Bitte tragen Sie eine Nachricht ein.<br/>
###type_separator***Text für Trenner***false***none***none***none***none***none***none***none<br/>
###type_select_single***Essen***true***essen***none***--- ? ---***3***Ihre Auswahl?***none***Bitte wählen Sie ein Essen aus.<br/>
+++type_select_single***Essen***true***essen***none***Pizza***3***Ihre Auswahl?***none***Bitte wählen Sie ein Essen aus.<br/>
+++type_select_single***Essen***true***essen***none***Salat***3***Ihre Auswahl?***none***Bitte wählen Sie ein Essen aus.<br/>
+++type_select_single***Essen***true***essen***none***Nudeln***3***Ihre Auswahl?***none***Bitte wählen Sie ein Essen aus.<br/>
+++type_select_single***Essen***true***essen***none***Schnitzel***3***Ihre Auswahl?***none***Bitte wählen Sie ein Essen aus.<br/>
+++type_select_single***Essen***true***essen***none***Würstchen***3***Ihre Auswahl?***none***Bitte wählen Sie ein Essen aus.<br/>
###type_select_multi***Getränke***true***getraenke***none***--- ? ---***3***Ihre Auswahl?***none***Bitte wählen Sie ein Getränk aus.<br/>
+++type_select_multi***Getränke***true***getraenke***none***Wasser***3***Ihre Auswahl?***none***Bitte wählen Sie ein Getränk aus.<br/>
+++type_select_multi***Getränke***true***getraenke***none***Cola***3***Ihre Auswahl?***none***Bitte wählen Sie ein Getränk aus.<br/>
+++type_select_multi***Getränke***true***getraenke***none***Fanta***3***Ihre Auswahl?***none***Bitte wählen Sie ein Getränk aus.<br/>
+++type_select_multi***Getränke***true***getraenke***none***Wein***3***Ihre Auswahl?***none***Bitte wählen Sie ein Getränk aus.<br/>
###type_file***Dateianhang***true***attachment***none***none***none***(max. 200 kb)***none***Bitte laden Sie eine Datei hoch.<br/>
###type_range***Schieberegler***true***schieberegler***none***1***0|5|1|0|80***none***0|1|2|3|4|5***Bitte wählen Sie einen Wert größer als 0 aus.<br/>
###type_page_end***none***false***none***none***3***none***none***zurück|-***none
     </div>
      </td></tr>';
echo '</table>';
Zuletzt geändert von McHubi am Di 26. Feb 2019, 22:22, insgesamt 8-mal geändert.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mi 20. Feb 2019, 00:49

Modul-Ausgabe
Stand: 13.04.2020

Code: Alles auswählen

<?php

/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname   :     form_generator_sd
* Author(s)   :     Seamless-Design Markus Hübner
* Copyright   :     Markus Hübner
* Created     :     08/2014
* modified    :     03/2016: added separator
* modified    :     07/2016: added variables to subject
* modified    :     01/2017: added variables send_from_... to counter restrictions of some hosters with sending mails
* modified    :     03/2017: fixed attachment-bug / added plain-text version / improved responsive design
* modified    :     05/2018: added support for html-tags within description of formfields
* modified    :     05/2018: added support for smtp
* modified    :     10/2018: added support for css-class within separator and empty fieldnames for some types
* modified    :     02/2019: added labels for input-fields, html5 functionality, new type_range, configurable frontend success note and paging
* modified    :     04/2020: added functionality for choosing send_from_name and send_from_email, if name of variable in article configuration is set to send_from_name and send_from_email
************************************************/

/*
######## README ######## 
# fieldtypes:
if you want to add new fieldtypes, you will have to look at ########## checking for errors begin ########## and  ########## displaying form begin ##########
# sending mails:
some hosters don't allow sending mails with "from-adresses" that are not located on the same server to provide spam. in this case, make your changes in variable $send_from_name and $send_from_email within settings
# smtp
if you want to use smtp as sendmethod instead of mail(), you have to set $use_smtp="true"; within settings. contenido then will check for the information within the "mailserver"-section you'll find in contenido backend via "administration -> system -> configuration". ask your provider for the needed data. at the current state of development, the entered data for the name and email of the sender is not read. therefor you'll have to fill in this information within the settings section of this module!
# send_from_name and send_from_email
for sending the email normally the data you set via $send_from_name and $send_from_email at the beginning of the settings-section in module output will be taken. if you prefer that the information that is given within form from your users is taken, you just have to change the name for the variables in article configuration tab from name to send_from_name and email to send_from_email. please be aware, that not all providers allow to use this option due to spam protection.
########################
*/


/********** settings begin **********/

$send_from_name=""; // if this is set to =""; the original name entered in form by the user will be taken
$send_from_email=""; // if this is set to =""; the original mail-address entered in form by the user will be taken
$use_smtp="true"; // set to "false" to use old mail()-function. 
$content_type="text/html"; // 'text/html' or 'text/plain' - only used when $use_smtp is set to "true"

$attachment_allowed="CMS_VALUE[300]";
$html5_functions="CMS_VALUE[700]";
$show_page_steps="CMS_VALUE[800]";
$show_data_in_success_note="CMS_VALUE[900]";
$separator_page_step_info=mi18n("output separator page step info");
/*
jpg: jpg
jpeg: jpeg
bmp: bmp
zip: octet-stream
doc: msword
docx: vnd.openxmlformats-officedocument.wordprocessingml.document
xls: plain
xlsx: vnd.openxmlformats-officedocument.spreadsheetml.sheet
*/
$array_allowed_filetypes=array('jpg','jpeg','gif','png','bmp','pdf','octet-stream','doc','plain');
$array_allowed_filetypes_hint=array('jpg','jpeg','gif','png','bmp','pdf','zip','doc','xls');
$allowed_filetypes_hint_form="";
foreach($array_allowed_filetypes_hint AS $element) $allowed_filetypes_hint_form.='<span class="allowed_filetypes">'.$element.'</span> ';
$filesize_max="CMS_VALUE[400]"*1;
$max_attach_size_hint=$filesize_max/1000000;
$anti_spam="CMS_VALUE[500]";
$amount_countchas=8;
$countcha_1="upload/module/form_generator_sd/countcha_1.png";
$countcha_2="upload/module/form_generator_sd/countcha_2.png";
$countcha_3="upload/module/form_generator_sd/countcha_3.png";
$name_countcha_1=mi18n("output form countcha 1 name");
$name_countcha_2=mi18n("output form countcha 2 name");
$name_countcha_3=mi18n("output form countcha 3 name");
$placeholder_select_something="--- ? ---";
$arr_search=array('ä','ö','ü','Ä','Ö','Ü','ß');
$arr_replace=array('&auml;','&ouml;','&uuml;','&Auml;','&Ouml;','&Uuml;','&szlig;');
/********** settings end **********/ 

/*
###0 type***1 fieldname***2 mandatory***3 name***4 class***5 value***6 size***7 beschreibung***8 additional***9 error message
maximum 1 attachment possible, name hast to be "attachment"
*/
$fields="CMS_VALUE[600]";
 

echo '<a name="startform"></a>';

$form_submitted=htmlspecialchars(strip_tags($_POST['form_submitted']));

$array_fields=explode('###',$fields);
unset($array_fields[0]);
//print_r($array_fields);

$array_field_names=array();
$array_field_names_mail_body_success_info=array();
$amount_of_pages=0;
$array_considered_form_fields=array();
foreach($array_fields AS $field)
  {
  $array_field_parts=explode('+++',$field);
  foreach($array_field_parts AS $part)
    {
   $array_field_parts_elements=explode('***',$part);
   if($array_field_parts_elements[0]=="type_page_begin") $amount_of_pages++;
   //0: type / 1: fieldname / 2: mandatory / 3: name / 4: class / 5: value / 6: size / 7: description / 8: additional / 9: error message
   if(!in_array($array_field_parts_elements[3],$array_considered_form_fields) OR $array_field_parts_elements[3]=="none")
   {
   $array_considered_form_fields[]=$array_field_parts_elements[3];
$array_field_names[]=array($array_field_parts_elements[3],$array_field_parts_elements[0],$array_field_parts_elements[2],$array_field_parts_elements[9],$array_field_parts_elements[1],$array_field_parts_elements[8],$array_field_parts_elements[5]);
   $array_field_names_mail_body_success_info[]=$array_field_parts_elements[1];
   }
   }
  }
$field_content_counter=1;



if($form_submitted!="")
  {
/*########## checking for errors begin ##########*/
$mail_body='<table>';
$mail_body_plain_text="";
$success_info='<div class="box_success_info">';
$i=1;
$amount_of_fields=count($array_field_names);

foreach($array_field_names AS $field)
  {
/* formatting and adding data for mail_body and success_info after sending form successfully begin */
  if(is_array($_POST[$field[0]]))
    {
    ${'value_'.$field[0]}=$_POST[$field[0]];
    if(${'value_'.$field[0]}[0]==$placeholder_select_something) ${'value_'.$field[0]}="";
    $array_temp=array();
    foreach(${'value_'.$field[0]} AS $element) $array_temp[]=htmlspecialchars(strip_tags($element));
    ${'value_'.$field[0]}=$array_temp;
    }
    else ${'value_'.$field[0]}=htmlspecialchars(strip_tags($_POST[$field[0]]));
  if(${'value_'.$field[0]}==$placeholder_select_something) ${'value_'.$field[0]}="";
  if(is_array(${'value_'.$field[0]}))
    {
    $field_value="";
    foreach(${'value_'.$field[0]} AS $field_value_part) $field_value.="*&nbsp;".$field_value_part.'<br/>';
    }
    else $field_value=str_replace($arr_search,$arr_replace,${'value_'.$field[0]});
  if($field[1]=="type_file")
    {
	$field_value=$_FILES[$field[0]]['name'];
	}
  if(${'value_'.$field[0]}!="" OR $field[1]=="type_file")
    {
    $mail_body.='<tr><td><b>'.str_replace($arr_search,$arr_replace,$field[4]).'</b></td><td>'.nl2br($field_value).'</td></tr>';
	$mail_body_plain_text.=str_replace($arr_search,$arr_replace,$field[4]).': '.nl2br($field_value).'\r\n';
    if($field[1]=="type_password") $field_value='*********';
    $success_info.='<div class="box_success_info_row"><div';
    if($i==1) $success_info.=' class="box_success_info_row_s1_z1_ueb"';
    if($i!=1 AND $i<$amount_of_fields) $success_info.=' class="box_success_info_row_s1_zx_ueb"';
    if($i==$amount_of_fields) $success_info.=' class="box_success_info_row_s1_zende_ueb"';
    $success_info.='>'.str_replace($arr_search,$arr_replace,$field[4]).'</div><div class="box_success_info_data">'.nl2br($field_value).'</div></div>';
    }
  if($field[1]=="type_separator")
    {
    $mail_body.='<tr><td colspan="2"><b>'.str_replace($arr_search,$arr_replace,$field[4]).'</b></td></tr>';
	$mail_body_plain_text.='\r\n'.str_replace($arr_search,$arr_replace,$field[4]).'\r\n';
    $success_info.='<div class="box_success_info_row"><div';
    if($i==1) $success_info.=' class="box_success_info_row_separator"';
    if($i!=1 AND $i<$amount_of_fields) $success_info.=' class="box_success_info_row_separator"';
    if($i==$amount_of_fields) $success_info.=' class="box_success_info_row_separator"';
    $success_info.='>'.str_replace($arr_search,$arr_replace,$field[4]).'</div></div>';
    }
/* formatting and adding data for mail_body and success_info after sending form successfully end */   

  // RADIO
  if($field[1]=="type_radio" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}=="")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  // CHECKBOX
  if($field[1]=="type_checkbox" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}=="")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  // SELECT SINGLE
  if($field[1]=="type_select_single" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}=="")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  // SELECT MULTI
  if($field[1]=="type_select_multi" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}=="")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  // TEXT
  if($field[1]=="type_text" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}=="")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  if($field[1]=="type_text" AND $field[0]=="send_from_name") $send_from_name=${'value_'.$field[0]};
  // NUMBER
  if($field[1]=="type_number")
    {
   if(${'value_'.$field[0]}=="" AND $field[2]=="true")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   if(!empty(${'value_'.$field[0]}))
      {
      if(!is_numeric(${'value_'.$field[0]}))
         {
         $array_errors[]=$field[3];
       $string_error_ids.=$field[0].';';
         }
         else
         {
       if($field[5]!="none")
         {
         $array_min_max=explode('|',$field[5]);
         if(${'value_'.$field[0]}*1<$array_min_max[0] OR ${'value_'.$field[0]}*1>$array_min_max[1])
           {
             $array_errors[]=$field[3];
           $string_error_ids.=$field[0].';';
           }
         }
         }
     }
   }
  // DATE
  if($field[1]=="type_date" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}=="")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   if(!empty(${'value_'.$field[0]}))
      {
     $timestamp=strtotime(${'value_'.$field[0]});
     if($timestamp=="")
       {
      $array_errors[]=$field[3];
      $string_error_ids.=$field[0].';';
      }
     }
   }
  // EMAIL
  if($field[1]=="type_email")
    {
   if(${'value_'.$field[0]}=="" AND $field[2]=="true")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   if(!empty(${'value_'.$field[0]}))
          {
          $mail_expr = "/^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/";
          if (!preg_match($mail_expr, ${'value_'.$field[0]}) )
             {
             $array_errors[]=$field[3];
          $string_error_ids.=$field[0].';';
             }
             else
             {
             if($field[0]=="send_from_email") $send_from_email=${'value_'.$field[0]};
             }
          }
   }
  // PASSWORD
  if($field[1]=="type_password" AND $field[2]=="true")
    {
    if(${'value_'.$field[0]}=="")
      {
      $array_errors[]=$field[3];
      $string_error_ids.=$field[0].';';
      }
    }
   if($field[1]=="type_password")
     {
     if(!empty(${'value_'.$field[0]}))
       {
       if(strlen(${'value_'.$field[0]}) < 6)
         {
         $array_errors[]=$field[3];
         $string_error_ids.=$field[0].';';
         }
       }
     }
  // TEXTAREA
  if($field[1]=="type_textarea")
    {
   if(${'value_'.$field[0]}=="" AND $field[2]=="true")
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  // FILE   
  if($field[1]=="type_file")
    {
    $array_filetype=explode('/',$_FILES[$field[0]]['type']);
    $filetype=strtolower($array_filetype[1]);
    $filesize=$_FILES[$field[0]]['size'];
   if($filetype=="" AND $field[2]=="true")
     {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   if($filetype!="")
      {
    if(!in_array($filetype,$array_allowed_filetypes))
      {
       $string_allowed_filetypes="";
       foreach($array_allowed_filetypes_hint AS $element) $string_allowed_filetypes.=$element." "; // building error hint from array of allowed filetypes
      $array_errors[]=mi18n("output em filetype not allowed")." ".$string_allowed_filetypes;
     $string_error_ids.="attachment;";
     }
    if($filesize>$filesize_max)
      {
     $array_errors[]=mi18n("output em filesize too big");
     $string_error_ids.="attachment;";
     }
    }
   }
  // RANGE
  if($field[1]=="type_range" AND $field[2]=="true")
    {
   if(${'value_'.$field[0]}<$field[6])
      {
     $array_errors[]=$field[3];
     $string_error_ids.=$field[0].';';
     }
   }
  $i++;
  }
  $mail_body.='</table>';
  $success_info.='</div>';
  // ANTI SPAM
  if($anti_spam=="true")
    {
   if($countcha!=$countcha_to_prove_amount)
     {
     $array_errors[]=mi18n("output em amount of countchas not correct");
     $string_error_ids.="countcha;";
     }
   }
  /* showing error messages begin */
  if(count($array_errors)>1) $array_errors=array_unique($array_errors);
  if(count($array_errors)==0) $no_errors="true";
    else
     {
     $no_errors="false";
     echo '<p class="formular_fehlermeldungen">'.mi18n("output em there are errors");
     echo '<ul class="formular_fehlermeldungen">';
     foreach($array_errors AS $element) echo '<li>'.$element.'</li>';
     echo '</ul></p>';
     }
  /* showing error messages end */
/*########## checking for errors end ##########*/
  }


/*################################*/
/*########## displaying form begin ##########*/
/*################################*/
if($form_submitted=="" OR $no_errors=="false")
{
echo '<form method="post" action="front_content.php?idart='.$idart.'#startform" enctype="multipart/form-data">';
echo '<div class="box_form">';
$row_counter=1;
$rows_overall=count($array_fields);
foreach($array_fields AS $field)
  {
  $class_td_separator="box_form_row_separator";
  if($row_counter==1)
    {
     $class_td_head="box_form_row_s1_z1_ueb";// nowrap";
     }
    elseif($row_counter<$rows_overall)
       {
       $class_td_head="box_form_row_s1_zx_ueb";// nowrap";
       }
  if($row_counter==$rows_overall)
    {
    $class_td_head="box_form_row_s1_zende_ueb";// nowrap";
     }
  //PAGE BEGIN
  if (strpos($field, 'type_page_begin***') !== false)
    {
    $array_field_to_show=explode('***',$field);
    echo '<div class="box_form_page" id="form_page_'.$array_field_to_show[5].'">';
    echo '<div class="box_form_row"><div class="box_form_row_page_begin">';
    echo $array_field_to_show[1];
    if($show_page_steps=="true") echo '<span class="page_step_info">'.$array_field_to_show[5].$separator_page_step_info.$amount_of_pages.'</span>';
    echo '</div></div>';
    echo '<script type="text/javascript">show_hide_form_page("initial",'.$array_field_to_show[5].','.$amount_of_pages.',"form_page_'.$array_field_to_show[5].'");</script>';
    }
  //PAGE END
  if (strpos($field, 'type_page_end***') !== false)
    {
    $array_field_to_show=explode('***',$field);
    $array_buttons=explode('|',$array_field_to_show[8]);
    echo '<div class="box_form_row"><div class="box_form_row_page_end">';
    if($array_buttons[0]!="-") echo '<input type="button" class="submit paging" value="'.$array_buttons[0].'" onclick="show_hide_form_page(\'previous\','.$array_field_to_show[5].','.$amount_of_pages.',\'form_page_'.$array_field_to_show[5].'\');"/>';
    if($array_buttons[1]!="-") echo '<input type="button" class="submit paging" value="'.$array_buttons[1].'" onclick="show_hide_form_page(\'next\','.$array_field_to_show[5].','.$amount_of_pages.',\'form_page_'.$array_field_to_show[5].'\');"/>';
    echo '</div></div>';
    echo '</div>';
    }
  //RADIO
  if (strpos($field, 'type_radio***') !== false)
    {
    $array_radios=explode('+++',$field);
   $amount_of_radios=count($array_radios);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    $i=1;
    foreach($array_radios AS $radio)
      {
     $array_field_to_show=explode('***',$radio);
      if($i==1)
       {
       echo $array_field_to_show[1].' ';
      if($array_field_to_show[2]=="true") echo '*';
        echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
       }
     echo '<input id="input_id_'.$array_field_to_show[3].'_'.htmlspecialchars_decode($array_field_to_show[7]).'" type="radio" name="'.$array_field_to_show[3].'"';
     if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
     if($array_field_to_show[5]!="none") echo ' value="'.$array_field_to_show[5].'"';
     if(${'value_'.$array_field_to_show[3]}==$array_field_to_show[5]) echo ' checked="checked"';
	 if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
     echo '/>';
     if($array_field_to_show[7]!="none") echo ' <label for="input_id_'.$array_field_to_show[3].'_'.htmlspecialchars_decode($array_field_to_show[7]).'">'.htmlspecialchars_decode($array_field_to_show[7]);
     if($i==$amount_of_radios) echo '</label></div></div>';
       else
        {
		echo '</label>';
        if($array_field_to_show[8]!="horizontal") echo '<br/>';
          else echo '&nbsp;';
        }
     $i++;
     }
    }
  //CHECKBOX
  if (strpos($field, 'type_checkbox***') !== false)
    {
    $array_checkboxes=explode('+++',$field);
   $amount_of_checkboxes=count($array_checkboxes);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    $i=1;
    foreach($array_checkboxes AS $checkbox)
      {
     $array_field_to_show=explode('***',$checkbox);
      if($i==1)
       {
       echo $array_field_to_show[1].' ';
      if($array_field_to_show[2]=="true") echo '*';
        echo '</div><div class="box_form_data">';
       }
     echo '<input id="input_id_'.$array_field_to_show[3].'" type="checkbox" name="'.$array_field_to_show[3].'"';
     if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
     if($array_field_to_show[5]!="none") echo ' value="'.$array_field_to_show[5].'"';
     if(${'value_'.$array_field_to_show[3]}==$array_field_to_show[5]) echo ' checked="checked"';
	 if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
     echo '/>';
     if($array_field_to_show[7]!="none") echo ' <span id="'.$array_field_to_show[3].'"><label for="input_id_'.$array_field_to_show[3].'">'.htmlspecialchars_decode($array_field_to_show[7]).'</span>';
     if($i==$amount_of_checkboxes) echo '</label></div></div>';
       else
        {
		echo '</label>';
        if($array_field_to_show[8]!="horizontal") echo '<br/>';
          else echo '&nbsp;';
        }
     $i++;
     }
    }
  //SELECT SINGLE
  if (strpos($field, 'type_select_single***') !== false)
    {
    $array_options=explode('+++',$field);
   $amount_of_options=count($array_options);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    $i=1;
    foreach($array_options AS $option)
      {
     $array_field_to_show=explode('***',$option);
      if($i==1)
       {
       echo $array_field_to_show[1].' ';
      if($array_field_to_show[2]=="true") echo '*';
        echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
        if($array_field_to_show[7]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[7].'</label><br/>';
       echo '<select id="input_id_'.$array_field_to_show[3].'" name="'.$array_field_to_show[3].'"';
       if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
       if($array_field_to_show[6]!="none") echo ' size="'.$array_field_to_show[6].'"';
	   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
        echo '/>';
       }
      echo '<option value="'.$array_field_to_show[5].'"';
     if(${'value_'.$array_field_to_show[3]}==$array_field_to_show[5]) echo ' selected';
     echo '>'.$array_field_to_show[5].'</option>';
     if($i==$amount_of_options) echo '</select></div></div>';
     $i++;
     }
    }
  //SELECT MULTI
  if (strpos($field, 'type_select_multi***') !== false)
    {
    $array_options=explode('+++',$field);
   $amount_of_options=count($array_options);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    $i=1;
    foreach($array_options AS $option)
      {
     $array_field_to_show=explode('***',$option);
      if($i==1)
       {
       echo $array_field_to_show[1].' ';
      if($array_field_to_show[2]=="true") echo '*';
        echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
        if($array_field_to_show[7]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[7].'</label><br/>';
       echo '<select id="input_id_'.$array_field_to_show[3].'" name="'.$array_field_to_show[3].'[]" multiple="multiple"';
       if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
       if($array_field_to_show[6]!="none") echo ' size="'.$array_field_to_show[6].'"';
	   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
        echo '/>';
       }
      echo '<option value="'.$array_field_to_show[5].'"';
     if(in_array($array_field_to_show[5],${'value_'.$array_field_to_show[3]})) echo ' selected';
     echo '>'.$array_field_to_show[5].'</option>';
     if($i==$amount_of_options) echo '</select></div></div>';
     $i++;
     }
    }
  //TEXT
  if (strpos($field, 'type_text***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
     if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
	   else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
    echo '<input id="input_id_'.$array_field_to_show[3].'" type="text" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   echo ' value="'.${'value_'.$array_field_to_show[3]}.'"';
   if($array_field_to_show[6]!="none") echo ' style="width: '.$array_field_to_show[6].'%;"';
   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
    if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]);
	echo '</div></div>';
    }
  //NUMBER
  if (strpos($field, 'type_number***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
     if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
	   else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
    echo '<input id="input_id_'.$array_field_to_show[3].'" type="';
	if($html5_functions=="true") echo 'number';
      else echo 'text';
	echo '" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   echo ' value="'.${'value_'.$array_field_to_show[3]}.'"';
   if($array_field_to_show[6]!="none") echo ' style="width: '.$array_field_to_show[6].'%;"';
   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
    if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]);
	echo '</div></div>';
    }
  //DATE
  if (strpos($field, 'type_date***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
	  else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
    echo '<input id="input_id_'.$array_field_to_show[3].'" type="';
	if($html5_functions=="true") echo 'date';
	  else echo 'text';
	echo '" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   echo ' value="'.${'value_'.$array_field_to_show[3]}.'"';
   if($array_field_to_show[6]!="none") echo ' style="width: '.$array_field_to_show[6].'%;"';
   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
    if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]);
	echo '</div></div>';
    }
  //EMAIL
  if (strpos($field, 'type_email***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
	  else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
    echo '<input id="input_id_'.$array_field_to_show[3].'" type="email" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   echo ' value="'.${'value_'.$array_field_to_show[3]}.'"';
   if($array_field_to_show[6]!="none") echo ' style="width: '.$array_field_to_show[6].'%;"';
   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
    if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]);
	echo '</div></div>';
    }
  //PASSWORD
  if (strpos($field, 'type_password***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
	  else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
    echo '<input id="input_id_'.$array_field_to_show[3].'" type="password" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   echo ' value="'.${'value_'.$array_field_to_show[3]}.'"';
   if($array_field_to_show[6]!="none") echo ' style="width: '.$array_field_to_show[6].'%;"';
   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
    if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]);
	echo '</div></div>';
    }
  //TEXTAREA
  if (strpos($field, 'type_textarea***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
      else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
   if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]).'<br/>';
    echo '<textarea id="input_id_'.$array_field_to_show[3].'" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   if($array_field_to_show[6]!="none")
     {
     $array_dimensions=explode('x',$array_field_to_show[6]);
     echo ' rows="'.$array_dimensions[0].'" style="width:'.$array_dimensions[1].'%;"';
     }
	if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
   echo ${'value_'.$array_field_to_show[3]};
   echo '</textarea>';
    echo '</div></div>';
    }
  //FILE
  if (strpos($field, 'type_file***') !== false AND $attachment_allowed=="true")
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
    if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
      else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '<br/><p class="formular_hinweis">'.$allowed_filetypes_hint_form.'</p>';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
    echo '<input id="input_id_'.$array_field_to_show[3].'" type="file" name="'.$array_field_to_show[3].'"';
    if($array_field_to_show[4]!="none") echo ' class="'.$array_field_to_show[4].'"';
   if (isset($_FILES[$array_field_to_show[3]]['name'])) echo $_FILES['attachment']['name']; else echo '-';
   if($array_field_to_show[2]=="true" AND $html5_functions=="true") echo ' required';
    echo '/>';
    if($array_field_to_show[7]!="none") echo '<br/>'.htmlspecialchars_decode($array_field_to_show[7]);
	echo '</div></div>';
    }
  //RANGE
  if (strpos($field, 'type_range***') !== false)
    {
    $array_field_to_show=explode('***',$field);
   echo '<div class="box_form_row"><div class="'.$class_td_head.'">';
     if($array_field_to_show[1]!="none") echo '<label for="input_id_'.$array_field_to_show[3].'">'.$array_field_to_show[1].'</label> ';
	   else echo '&nbsp;';
     if($array_field_to_show[2]=="true") echo '*';
   echo '</div><div class="box_form_data" id="'.$array_field_to_show[3].'">';
   if($array_field_to_show[7]!="none") echo ' '.htmlspecialchars_decode($array_field_to_show[7]).'<br/>';
   if($array_field_to_show[6]!="none") // individual configuration is given
     {
     $array_range_min_max_step_start_width=explode('|',$array_field_to_show[6]);
     echo $array_range_min_max_step_start_width[0].'<input id="input_id_'.$array_field_to_show[3].'" type="range" name="'.$array_field_to_show[3].'" min="'.$array_range_min_max_step_start_width[0].'" max="'.$array_range_min_max_step_start_width[1].'" step="'.$array_range_min_max_step_start_width[2].'"';
	 if(${'value_'.$array_field_to_show[3]}=="") echo ' value="'.$array_range_min_max_step_start_width[3].'" ';
	   else echo ' value="'.${'value_'.$array_field_to_show[3]}.'" ';
	 echo 'style="width: '.$array_range_min_max_step_start_width[4].'%;"';
	 if($array_field_to_show[8]!="none") echo ' list="tickmarks_input_id_'.$array_field_to_show[3].'"';
	 echo '/>'.$array_range_min_max_step_start_width[1];
	 }
	 else // individual configuration is not given
	  {
	  echo '0<input id="input_id_'.$array_field_to_show[3].'" type="range" name="'.$array_field_to_show[3].'" min="0" max="10" step="1"';
	  if(${'value_'.$array_field_to_show[3]}=="") echo ' value="0" ';
	    else echo ' value="'.${'value_'.$array_field_to_show[3]}.'" ';
	  if($array_field_to_show[8]!="none") echo ' list="tickmarks_input_id_'.$array_field_to_show[3].'"';
	  echo '/>10';
	  }
	if($array_field_to_show[8]!="none")
	  {
	  $array_range_tickmarks=explode('|',$array_field_to_show[8]);
	  echo '<datalist id="tickmarks_input_id_'.$array_field_to_show[3].'">';
	  foreach($array_range_tickmarks AS $tickmark) echo '<option value="'.$tickmark.'">';
      echo '</datalist>';
	  }
	echo '</div></div>';
    }
  //SEPARATOR
  if (strpos($field, 'type_separator***') !== false)
    {
    $array_field_to_show=explode('***',$field);
    echo '<div class="box_form_row"><div class="'.$class_td_separator;
	if($array_field_to_show[4]!="none") echo ' '.$array_field_to_show[4];
	echo '">';
    echo $array_field_to_show[1].' ';
    echo '</div></div>';
    }
   $row_counter++;
  }
echo '</div>';

echo '<p class="hint_mandatory_fields">'.mi18n("output form * fields have to be filled").'</p>';

/********** anti_spam begin **********/
if($anti_spam=="true")
  {
  $amount_countcha_1=rand(1,$amount_countchas);
  $amount_countcha_2=rand(1,$amount_countchas-$amount_countcha_1);
  $amount_countcha_3=rand(1,$amount_countchas-$amount_countcha_1-$amount_countcha_2);
  $countcha_chosen=rand(1,3);
  $countcha_chosen_hint=${'name_countcha_'.$countcha_chosen};
  $countcha_to_prove_amount=${'amount_countcha_'.$countcha_chosen};
  echo '<div class="formular_anti_spam">';
  echo '<input type="hidden" name="countcha_to_prove_amount" value="'.$countcha_to_prove_amount.'"/>';
  $c=1;
  while($c<=3)
    {
    $i=0;
    while($i<${'amount_countcha_'.$c})
      {
     echo '<img class="countcha" src="'.${'countcha_'.$c}.'" title="" alt=""/>';
     $i++;
     }
    $c++;
    }
  echo '<br/>'.mi18n("output form anti_spam_hint_1");
  echo ' '.$countcha_chosen_hint.' ';
  echo mi18n("output form anti_spam_hint_2");
   echo ' <input id="countcha" type="text" class="text" style="width: 5em;" name="countcha" value="';
      if (isset($countcha)) echo $countcha; else echo '';
      echo '"/>';
  echo '</div>';
  }
/********** anti_spam end **********/
echo '<input class="submit" type="submit" name="form_submitted" value="'.mi18n("output form send").'"/>';
echo '</form>';
}


/********** marking errors begin **********/
// this part has to run after the form is fully displayed. otherwise the ids would not be present for js
if($form_submitted!="" AND $no_errors=="false")
  {
  ?>
  <script type="text/javascript">
  var var_string_error_ids="<?php echo $string_error_ids;?>";
  var array_error_ids=var_string_error_ids.split(";");
  var a=0;
  while(a!=array_error_ids.length)
    {
    document.getElementById(array_error_ids[a]).style.backgroundColor="#ff0000";
    a=a+1;
    }
  </script>
  <?php
  }
/********** marking errors end **********/

/*###############################*/
/*########## displaying form end ##########*/
/*###############################*/



/*##############################################*/
/*########## sending mail and displaying mailed data begin ##########*/
/*#############################################*/
/********** sending mail begin **********/
if($use_smtp=="false")
{
if($form_submitted!="" AND $no_errors=="true")
  {
  $ip = htmlspecialchars(strip_tags($_SERVER["REMOTE_ADDR"]));
  if($gender=="female") $gender_mail=mi18n("output email female");
    else $gender_mail=mi18n("output email male");
  //building array with recipients
  $recipients = "CMS_VALUE[100]";
  $array_recipients=array_filter(explode("//",$recipients));
  $recipients_in_array=explode("//",$recipients);
  //formatting subject of email
  $mail_subject="CMS_VALUE[200]";
  $mail_subject_variables="CMS_VALUE[210]";
  if($mail_subject_variables!="")
    {
    $array_mail_subject_variables=explode("###",$mail_subject_variables);
    foreach($array_mail_subject_variables AS $subject_variable) $mail_subject.=utf8_decode(' '.${$subject_variable});
    }
  // mail_body ist build within checking for errors section
  if($send_from_name!="" AND $send_from_email!="")
    {
	$name=$send_from_name;
	$email=$send_from_email;
	}
  if($filetype=="")
  {
$random_hash = md5(date('r', time()));
$headers = "From: ".$send_from_email."\r\nReply-To: ".$send_from_email;
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
ob_start(); //Turn on output buffering, IMPORTANT: DO NOT REMOVE ANY OF THE FOLLOWING EMPTY LINES OR ADD BLANKSPACES BEFORE THE CODELINES TILL $message = ob_get_clean();!!! OTHERWISE THE CODE WON'T WORK BECAUSE OF WRONG BUFFER-CONTENTS!!!
?>
--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo $mail_body_plain_text."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo nl2br($mail_body)."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?>--
<?php
$message = ob_get_clean();//copy current buffer contents into $message variable and delete current output buffer
  }
  else
    {
$random_hash = md5(date('r', time()));
$headers = "From: ".$send_from_email."\r\nReply-To: ".$send_from_email;
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['attachment']['tmp_name'])));
ob_start();  //Turn on output buffering, IMPORTANT: DO NOT REMOVE ANY OF THE FOLLOWING EMPTY LINES OR ADD BLANKSPACES BEFORE THE CODELINES TILL $message = ob_get_clean();!!! OTHERWISE THE CODE WON'T WORK BECAUSE OF WRONG BUFFER-CONTENTS!!!
?>
--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo $mail_body_plain_text."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo nl2br($mail_body)."\n"; ?>

--PHP-alt-<?php echo $random_hash; ?>--

--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: <?php echo $_FILES['attachment']['type']; ?>; name="<?php echo $_FILES['attachment']['name']; ?>"
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--

<?php
$message = ob_get_clean();//copy current buffer contents into $message variable and delete current output buffer
    }
if($use_smtp=="false")
  {
  foreach($recipients_in_array as $recipient)
    {
    if (@mail($recipient,$mail_subject,$message,$headers)) $sent = true;
      else echo "<br/>keine Verbindung zum Mailserver - bitte nochmal versuchen";
    }
  }
/********** sending mail end **********/
/********** displaying mailed data begin **********/
if($show_data_in_success_note=="true")
  {
  echo '<p>'.mi18n("output form following information was mailed").'</p>';
  echo $success_info; // build within checking for errors section
  }
  else echo '<p>'.mi18n("output form simple success info").'</p>';
/********** displaying mailed data end **********/
  }
}
else
{	
if($form_submitted!="" AND $no_errors=="true")
  {	  
  $ip = htmlspecialchars(strip_tags($_SERVER["REMOTE_ADDR"]));
  if($gender=="female") $gender_mail=mi18n("output email female");
    else $gender_mail=mi18n("output email male");
  //building array with recipients
  $recipients = "CMS_VALUE[100]";
  $array_recipients=array_filter(explode("//",$recipients));
  $recipients_in_array=explode("//",$recipients);
  //formatting subject of email
  $mail_subject="CMS_VALUE[200]";
  $mail_subject_variables="CMS_VALUE[210]";
  if($mail_subject_variables!="")
    {
    $array_mail_subject_variables=explode("###",$mail_subject_variables);
    foreach($array_mail_subject_variables AS $subject_variable) $mail_subject.=utf8_decode(' '.${$subject_variable});
    }
  // mail_body is build within checking for errors section
  $mailer = new cMailer();
  $message = Swift_Message::newInstance();
  $message->setFrom($send_from_email);
  $message->setSubject($mail_subject);
  $message->setContentType($content_type);
  if($content_type=="text/html") $message->setBody($mail_body);
    else $message->setBody($mail_body_plain_text);
  if($filetype!="")
    {
	$message->attach(Swift_Attachment::fromPath($_FILES['attachment']['tmp_name'])->setFilename($_FILES['attachment']['name']));
    }
  foreach($recipients_in_array as $recipient)
    {
    $message->setTo($recipient);
    $mailer->send($message);
	}
  if($show_data_in_success_note=="true")
    {
    echo '<p>'.mi18n("output form following information was mailed").'</p>';
    echo $success_info; // build within checking for errors section
    }
    else echo '<p>'.mi18n("output form simple success info").'</p>';
  }
}
/*############################################*/
/*########## sending mail and displaying mailed data end ##########*/
/*############################################*/
?>
Zuletzt geändert von McHubi am Mo 13. Apr 2020, 13:04, insgesamt 15-mal geändert.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mi 20. Feb 2019, 00:49

CSS
Stand: 21.02.2019

Code: Alles auswählen

div.box_form {
margin-top: 2em;
clear: both;
padding: 0.5em;
}
div.box_form_row {
clear: both;
margin-bottom: 1px;
overflow: hidden;
}
div.box_form_row_s1_z1_ueb {
float: left;
width: 40%;
color: #023062;
font-weight: 900;
}
div.box_form_row_s1_zx_ueb {
float: left;
width: 40%;
border-top: 0px solid #e6e6e6;
color: #023062;
font-weight: 900;
}
div.box_form_row_s1_zende_ueb {
float: left;
width: 40%;
border-top: 0px solid #e6e6e6;
color: #023062;
font-weight: 900;
}
div.box_form_data {
float: left;
width: 60%;
}
div.box_form_page {
}
div.box_form_row_page_begin {
border-bottom: 1px solid #ffffff;
}
div.box_form_row_page_end {
border-top: 1px solid #ffffff;
text-align: center;
}
div.box_form_row_separator {
width: 100%;
border-top: 0px solid #e6e6e6;
font-weight: 900;
color: #ffffff;
}
div.box_success_info {
margin-top: 2em;
clear: both;
padding: 0.5em;
overflow: hidden;
}
div.box_success_info_row {
clear: both;
}
div.box_success_info_row_s1_z1_ueb {
float: left;
width: 40%;
color: #023062;
font-weight: 900;
}
div.box_success_info_row_s1_zx_ueb {
float: left;
width: 40%;
border-top: 0px solid #e6e6e6;
color: #023062;
font-weight: 900;
}
div.box_success_info_row_s1_zende_ueb {
float: left;
width: 40%;
border-top: 0px solid #e6e6e6;
color: #023062;
font-weight: 900;
}
div.box_success_info_data {
float: left;
width: 60%;
}
div.box_success_info_row_separator {
width: 100%;
border-top: 0px solid #e6e6e6;
color: #023062;
font-weight: 900;
}

img.countcha {
height: 2em;
width: auto;
margin-right: 0.1em;
}
input.text {
width: 90%;
border: 1px solid #ffffff;
background-color: #ffffff;
}
textarea.textarea {
width: 100%;
border: 1px solid #ffffff;
background-color: #ffffff;
}
input.paging {
margin: 0.5em;
}
input.submit {
margin-top: 1em;
padding: 0.5em;
border: 1px solid #023062;
border-radius: 0.2em;
background-color: #ffffff;
color: #023062;
text-decoration: none;
transition: background-color 1s;
}
input.submit:hover {
margin-top: 1em;
background-color: #023062;
color: #ffffff;
cursor: pointer;
}
div.formular_anti_spam {
}
p.formular_fehlermeldungen,
ul.formular_fehlermeldungen {
color: #ff0000;
}
p.formular_hinweis,
span.formular_hinweis {
font-size: 0.9em;
font-weight: normal;
}
p.hint_mandatory_fields {
}
span.formular_allowed_filetypes {
padding: 1px;
}
span.page_step_info {
margin-left: 1em;
}

.nowrap {
}
.fgsd_sep_personal_data,
.fgsd_sep_where,
.fgsd_sep_general_cleaning,
.fgsd_sep_hygiene,
.fgsd_sep_carpet,
.fgsd_sep_message,
.fgsd_sep_windows,
.fgsd_sep_date {
background-size: contain;
background-repeat: no-repeat;
background-position: center left;
padding-left: 4em;
margin-top: 1em;
margin-bottom: 0.5em;
height: 3em;
line-height: 3em;
border-bottom: 1px solid #023062;
}
.fgsd_sep_personal_data {
background-image: url('../upload/module/form_generator_sd/icon-form-personal-data.png');
}
.fgsd_sep_where {
background-image: url('../upload/module/form_generator_sd/icon-form-where.png');
}
.fgsd_sep_intro {
margin-top: 2em;
margin-bottom: 2em;
}
.fgsd_sep_general_cleaning {
background-image: url('../upload/module/form_generator_sd/icon-form-general-cleaning.png');
}
.fgsd_sep_hygiene {
background-image: url('../upload/module/form_generator_sd/icon-form-hygiene.png');
}
.fgsd_sep_carpet {
background-image: url('../upload/module/form_generator_sd/icon-form-carpet.png');
}
.fgsd_sep_windows {
background-image: url('../upload/module/form_generator_sd/icon-form-window.png');
}
.fgsd_sep_date {
background-image: url('../upload/module/form_generator_sd/icon-form-calendar.png');
}
.fgsd_sep_message {
background-image: url('../upload/module/form_generator_sd/icon-form-message.png');
}
@media only screen and (max-width: 49em) {
div.box_form_row_s1_z1_ueb,
div.box_form_row_s1_zx_ueb,
div.box_form_row_s1_zende_ueb,
div.box_form_data {
width: 100%;
}
}
JavaScript
Stand: 21.02.2019

Code: Alles auswählen

/*
IMPORTANT:
this function has to be loaded at the start of webpage rendering. placed here within the module itself, it will be loaded at the end of page rendering. so you have to take this code and embed it earlier, e.g. in <head>
it is noted here just for "package"-purposes.

function show_hide_form_page(var_reason_of_calling_function,var_page_number,var_pages_total,var_id_current_page) {
if(var_reason_of_calling_function=="initial" && var_page_number>1) document.getElementById(var_id_current_page).style.display="none";
if(var_reason_of_calling_function=="next")
  {
  var var_page_number_next=var_page_number+1;
  var var_id_next_page="form_page_"+var_page_number_next;
  document.getElementById(var_id_current_page).style.display="none";
  document.getElementById(var_id_next_page).style.display="block";
  window.location.hash = "startform";
  }
if(var_reason_of_calling_function=="previous")
  {
  var var_page_number_previous=var_page_number-1;
  var var_id_previous_page="form_page_"+var_page_number_previous;
  document.getElementById(var_id_current_page).style.display="none";
  document.getElementById(var_id_previous_page).style.display="block";
  window.location.hash = "startform";
  }
}
*/
lang_de_DE.txt
Stand: 26.02.2019

Code: Alles auswählen

input activate data in success note=Eingetragene Daten in Sendebestätigung anzeigen?
input activate html5 functions=HTML5-Funktionen aktivieren?
input activate page step info=Bei mehrseitigen Formularen: Formularschritt anzeigen?
input anti_spam active=Spamschutz aktivieren?
input attachment allowed=Dateianhang erlauben?
input email subject=eMail-Betreff
input email subject hint=Betreff
input email subject variables=Variablen im Betreff
input email subject variables hint=Variablen aus Formularfeldern eintragen und mit ### voneinander trennen. Beispiel:
input examples=Komplettes Beispielformular
input explanations=Erläuterungen
input filesize max=Maximale Dateigröße
input filesize max hint=(in Bytes, 1MB\=1000000 Bytes)
input form fields=Formularfelder
input please save content in case of accidentally deleting it=Tipp: Sichern Sie den Inhalt dieses Feldes z. B. in einer Textdatei um im Falle eines unbeabsichtigten Löschens das Formular wieder herstellen zu können.
input recipients=eMail-Adressen Empfänger
input recipients hint=weitere Empfänger
no=nein
output em amount of countchas not correct=Sie haben die Frage zum Spamschutz nicht korrekt beantwortet.
output em filesize too big=Der Dateianhang ist zu groß.
output em filetype not allowed=Das Format des Dateianhangs ist nicht erlaubt.
output em there are errors=Beim Absenden des Formulars sind Fehler aufgetreten:
output email female=Frau
output email male=Herr
output form * fields have to be filled=* Pflichtfelder
output form anti_spam_hint_1=Wie viele
output form anti_spam_hint_2=sehen Sie?
output form countcha 1 name=Punkte
output form countcha 2 name=Quadrate
output form countcha 3 name=Dreiecke
output form following information was mailed=Vielen Dank für Ihre Nachricht. Sie haben uns diese Informationen zukommen lassen:
output form send=Abschicken
output form simple success info=Vielen Dank für ihre Nachricht.
output separator page step info=&nbsp;von&nbsp;
yes=ja
Zuletzt geändert von McHubi am Di 26. Feb 2019, 18:19, insgesamt 4-mal geändert.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Do 21. Feb 2019, 17:48

So, nach langer Zeit endlich dazu gekommen ein neues Feature einzubinden, was den Generator noch einmal erheblich aufwertet :mrgreen:

EDIT 21.02.2019: Es können jetzt nicht mehr nur einseitige sondern auch mehrseitige Formulare umgesetzt werden.

Wie immer gilt, dass die hier im Forum hinterlegten Sourcen auf dem neuesten Stand sind...
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Di 26. Feb 2019, 17:43

Und wieder etwas neues, klein aber fein:

EDIT 26.02.2019: Die Versandbestätigung im Frontend nach dem Absenden kann jetzt wahlweise ohne oder mit Darstellung der versendeten Daten erfolgen.

Angepasste Ressourcen:
-Modul-Eingabe
-Modul-Ausgabe
-Übersetzung

Wie immer sind die hier geposteten Quelltexte sind bereits angepasst.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

lunsen_de
Beiträge: 297
Registriert: Mo 17. Okt 2005, 20:26
Wohnort: Weimar
Kontaktdaten:

Re: Formulargenerator

Beitrag von lunsen_de » Mo 9. Mär 2020, 14:22

Hallo,

ich habe nach dem Installieren des Moduls (letzte Version) einige Probleme.

Integration in 4.9.12, PHP Version 7.0.33

1. Wenn ich in den Settings im Output einstelle:

Code: Alles auswählen

$send_from_name=""; // if this is set to =""; the original name entered in form by the user will be taken
$send_from_email=""; // if this is set to =""; the original mail-address entered in form by the user will be taken
$use_smtp="false"; // set to "false" to use old mail()-function. 
$content_type="text/html"; // 'text/html' or 'text/plain' - only used when $use_smtp is set to "true"
Kommt eine E-Mail an, allerdings ohne Absender (im Formular ist E-Mail Feld etc. Alles drin).

Wenn ich die beiden Felder $send_from_name und $send_from_email befülle kommt die Mail an, und es wird beim Absender im Client die im Modul eingetragende E-Mail Adresse angezeigt. Ich hätte lieber die vom Formular, also von dem der ausfüllt.

Sehr hier nicht warum das bei der Einstellung ="" im Modul dazu führt, dass kein Absender übernommen wird:

2. Wenn ich an selber Stelle SMTP auf true stelle, kommt keine Mail, wenn die beiden ersten Einstellungen leer sind (in der Sytemkonfig ist Alles eingetragen, smtp funktionert auch, getestet mit dem Pifa). Die Bestätigungsseite nach dem Absenden endet im Quelltext beim Anker #startform, dann kommt Nichts mehr

Code: Alles auswählen

$send_from_name=""; // if this is set to =""; the original name entered in form by the user will be taken
$send_from_email=""; // if this is set to =""; the original mail-address entered in form by the user will be taken
$use_smtp="true"; // set to "false" to use old mail()-function. 
$content_type="text/html"; // 'text/html' or 'text/plain' - only used when $use_smtp is set to "true"
Wenn ich die beiden Felder $send_from_name und $send_from_email befülle kommt die Mail an, allerdings wieder nur mit dem voreingestellten Absender.

Fehlermedung bei der nichtzuendegeladenen Seite (Ende Quelltext bei Anker #startform):

Code: Alles auswählen

[09-Mar-2020 12:29:05 Europe/Berlin] PHP Fatal error:  Uncaught Swift_RfcComplianceException: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. in ....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:348
Stack trace:
#0 ....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(263): Swift_Mime_Headers_MailboxHeader->_assertValidAddress('')
#1 ....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(106): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array)
#2 ....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(63): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array)
#3 ....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php(602): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array)
#4 ....Pfad..../httpdocs/contenido/classes/swiftmailer/li in ....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php on line 348
Habe ich eine Einstellung vergessen oder etwas falsch eingestellt?

Grüße larslunsen

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Formulargenerator

Beitrag von McHubi » Mo 9. Mär 2020, 21:46

Hallo Lars,
1. Wenn ich in den Settings im Output einstelle: ... Kommt eine E-Mail an, allerdings ohne Absender (im Formular ist E-Mail Feld etc. Alles drin).

Code: Alles auswählen

$send_from_name=""; // if this is set to =""; the original name entered in form by the user will be taken
$send_from_email=""; // if this is set to =""; the original mail-address entered in form by the user will be taken
$use_smtp="false"; // set to "false" to use old mail()-function. 
$content_type="text/html"; // 'text/html' or 'text/plain' - only used when $use_smtp is set to "true"
Ich muss mir das nochmal genauer angucken. Aber so wie es beim ersten Querlesen ausschaut, ist der Part hier in der Modulausgabe

Code: Alles auswählen

  // mail_body ist build within checking for errors section
  if($send_from_name!="" AND $send_from_email!="")
    {
	$name=$send_from_name;
	$email=$send_from_email;
	}
ein Relikt aus älteren Zeiten des Moduls. Denn $name und $email tauchen sonst nirgendwo mehr auf... Insofern dürften die Kommentare dazu oben nicht mehr ganz frisch sein...
Die Mailadresse des Absenders vom Formular wird ja - wenn danach im Formular gefragt wird - im Mailbody mit übertragen.
Wenn ich die beiden Felder $send_from_name und $send_from_email befülle kommt die Mail an, und es wird beim Absender im Client die im Modul eingetragende E-Mail Adresse angezeigt. Ich hätte lieber die vom Formular, also von dem der ausfüllt.
Dann läuft es ja schon mal grundsätzlich. Wenn Du die "echte" Mailadresse des Seitennutzers haben möchtest, musst Du hier Deine Anpassungen vornehmen:

Code: Alles auswählen

  // mail_body ist build within checking for errors section
  if($send_from_name!="" AND $send_from_email!="")
    {
	$name=$send_from_name;
	$email=$send_from_email;
	}
Und zwar - teste das bitte mal - einfach umdrehen:

Code: Alles auswählen

  // mail_body ist build within checking for errors section
  if($send_from_name!="" AND $send_from_email!="")
    {
	$send_from_name=$name;
	$send_from_email=$email;
	}
Wichtig ist dann aber, dass auch die Variablen in der Konfiguration des Formulars entsprechend benannt sind:

Code: Alles auswählen

###type_text***Name***true***name***text***none***none***none***none***Bitte tragen Sie Ihren Namen ein.
###type_email***E-Mail***true***email***text***none***none***none***none***Bitte tragen Sie eine korrekte E-Mail Adresse ein.
Vermutlich habe ich das deshalb nicht aus dem Code entfernt...
Wenn ich an selber Stelle SMTP auf true stelle, kommt keine Mail, wenn die beiden ersten Einstellungen leer sind
Da schlägt dann das hier zu:
# sending mails:
some hosters don't allow sending mails with "from-adresses" that are not located on the same server to provide spam. in this case, make your changes in variable $send_from_name and $send_from_email within settings
Viele Grüße

Markus
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

lunsen_de
Beiträge: 297
Registriert: Mo 17. Okt 2005, 20:26
Wohnort: Weimar
Kontaktdaten:

Re: Formulargenerator

Beitrag von lunsen_de » Di 10. Mär 2020, 14:39

Hallo, leider haben die Änderungen keinen Erfolg. Ich habe Alles so umgesetzt und trotzdem kommen bei:

Code: Alles auswählen

$send_from_name=""; 
$send_from_email="";
$use_smtp="false";
nur Mails an die keine Absender-Email-Adresse haben (In Outlook ist das Feld "Von" leer)

und im Fall:

Code: Alles auswählen

$send_from_name=""; 
$send_from_email="";
$use_smtp="true";
kommt keine Mail an und der Quelltext der Bestätigungsseite endet bei:

Code: Alles auswählen

..... <a name="startform"></a>
Nach dem SMTP Versuch steht in der Errorlog:

Code: Alles auswählen

[10-Mar-2020 14:36:15 Europe/Berlin] PHP Fatal error:  Uncaught Swift_RfcComplianceException: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. in /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:348
Stack trace:
#0 /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(263): Swift_Mime_Headers_MailboxHeader->_assertValidAddress('')
#1 /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(106): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array)
#2 /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(63): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array)
#3 /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php(602): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array)
#4 /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/li in /var/....Pfad..../httpdocs/contenido/classes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php on line 348
Grüße larslunsen

Antworten