Copyright (c) 2006 by Anno Copyright (c) 2006 by Sandy Schoen Copyright (c) 2007 Martin Kerz This is GPL, only it seems odd to include a license in a programm that has twice the size of the license. Modifications to work with PmWiki 2.0, Copyright (c) 2005 by Patrick R. Michaud Revision 1.5 20070803 Martin Kerz * Modifications to create xhtml compliant forms * Included modifications to send the email in utf-8 by Anno * Included confirmation code of emailform-s.php by Sandy Schoen */ # Version date SDV($RecipeInfo['MailForm']['Version'], '2007-08-03'); XLSDV('en', array( 'MF' => '', 'MFsuccess' => 'Message has been sent successfully.', 'MFfailure' => 'Message could not be sent.', 'MFerror' => 'An error has occurred.', 'MFwrongcode' => 'Wrong confirmation code. Are you sure you are human?')); $r = @$_REQUEST['mailform']; $MailFormResult = FmtPageName("$[MF$r]", $pagename); $ACodeCalc = rand(100,999); # This is the default form, as a table. The '$1' is replaced with # the word that comes after the mailform: markup -- the rest are # straightforward $...Fmt substitutions. if ($MailFormSecurity==true) SDV($MailFormFmt,"
\$MailFormResult





"); else SDV($MailFormFmt,"
\$MailFormResult




"); # This defines the mailform: markup -- it's just a straight text # substitution. Markup('mailform', '>links', '/\\bmailform:(\\w+)/', FmtPageName($MailFormFmt, $pagename)); # These define what happens after someone has submitted a message. # The variables are the header and footer for the email message, # while HandleMailForm sends the message according to the # value of 'address' in the request. SDV($MailFormHeader,""); SDV($MailFormFooter, "\n-------------------------------------------\n" ."This message was sent by the PmWiki MailForm at $ScriptUrl\n"); SDV($MailFormDefaultSender,""); $HandleActions['mailform'] = 'HandleMailForm'; function HandleMailForm($pagename) { global $MailFormAddresses, $MailFormHeader, $MailFormFooter, $MailFormDefaultSender, $MailFormUTF8; $to = $MailFormAddresses[$_REQUEST['address']]; $from = $_REQUEST['sender']; $subject = $_REQUEST['subject']; $text = $MailFormHeader.stripmagic($_REQUEST['text']).$MailFormFooter; $text = nl2br($text); $headers = "MIME-Version: 1.0\r\n"; if ($MailFormUTF8==true) $headers .= "Content-type: text/html;charset=utf-8\r\n"; else $headers .= "Content-type: text/html;charset=iso-8859-2\r\n"; $headers .= "From: $from\r\n"; if (!$from) $from=$MailFormDefaultSender; if (!$to || !$_REQUEST['text'] || ($MailFormSecurity==true && $_REQUEST['ACodeReturn'] != $_REQUEST['ACodeEntered']) ) $msg = 'error'; else if (mail($to, $subject, $text, $headers)) $msg = 'success'; else $msg = 'failure'; header("Location: $ScriptUrl?pagename=$pagename&mailform=$msg"); } ?>