diff --git a/cgi-bin/mail-signup.php b/cgi-bin/mail-signup.php new file mode 100644 index 0000000000..1237c69546 --- /dev/null +++ b/cgi-bin/mail-signup.php @@ -0,0 +1,60 @@ + $name, + 'email1' => $mail, + 'address' => $address, + 'zip' => $zip, + 'city' => $city, + 'country' => $country + ); + print_r($signupdata); + mail_signup('https://my.fsfe.org/subscribe', $signupdata); +} elseif ($list == 'newsletter') { + echo ""; +} else { + echo "List to sign up email to is unknown. Exiting."; + exit(1); +} + +function mail_signup($url, $data) { + $context = stream_context_create( + array( + 'http' => array( + 'method' => 'POST', + 'header' => 'Content-type: application/x-www-form-urlencoded', + 'content' => http_build_query($data), + 'timeout' => 10 + ) + ) + ); + file_get_contents($url, FALSE, $context); +} + +?> diff --git a/cgi-bin/promotion.php b/cgi-bin/promotion.php index 741db3dcf3..bfab4e4e9c 100644 --- a/cgi-bin/promotion.php +++ b/cgi-bin/promotion.php @@ -111,6 +111,22 @@ function send_mail ( $to, $from, $subject, $msg, $bcc = NULL, $att = NULL, $att_ return mail( $to, $subject, $message, $headers ); } +# send information to mail-signup.php if user wished to sign up to community mails or newsletter +function mail_signup($data) { + $url = $_SERVER['REQUEST_SCHEME']. '://' . $_SERVER['HTTP_HOST'] . '/cgi-bin/mail-signup.php'; + $context = stream_context_create( + array( + 'http' => array( + 'method' => 'POST', + 'header' => 'Content-type: application/x-www-form-urlencoded', + 'content' => http_build_query($data), + 'timeout' => 10 + ) + ) + ); + file_get_contents($url, FALSE, $context); +} + $lang = $_POST['language']; # Sanity checks (*very* sloppy input validation) @@ -196,6 +212,20 @@ $name = escapeshellarg($name); $address = escapeshellarg($address); shell_exec("$odtfill $template $outfile Name=$name Address=$address Name=$name"); +# Make subscriptions to newsletter/community mails +if ($_POST['subcd'] == "y") { + $signupdata = array( + 'list' => 'community', + 'name' => $_POST['firstname'] . " " . $_POST['lastname'], + 'mail' => $_POST['mail'], + 'address' => $_POST['street'], + 'zip' => $_POST['zip'], + 'city' => $_POST['city'], + 'country' => $countrycode + ); + mail_signup($signupdata); +} + $test = send_mail ("contact@fsfe.org", $_POST['firstname'] . " " . $_POST['lastname'] . " <" . $_POST['mail'] . ">", $subject, $msg, NULL, file_get_contents($outfile), "application/vnd.oasis.opendocument.text", "letter.odt"); if (isset($_POST['donate']) && ($_POST['donate'] > 0)) { diff --git a/contribute/spreadtheword.en.xhtml b/contribute/spreadtheword.en.xhtml index fb178ee0e8..99b9bc3b83 100644 --- a/contribute/spreadtheword.en.xhtml +++ b/contribute/spreadtheword.en.xhtml @@ -237,11 +237,10 @@