[PHP-WEBMASTER] [web-master] main: Handle the -noemail version of lists, too (#28)

Author: Jim Winstead (jimwins)
Committer: GitHub (web-flow)
Pusher: jimwins
Date: 2024-09-19T16:28:14-07:00

Commit: Handle the -noemail version of lists, too (#28) · php/web-master@bd2ab46 · GitHub
Raw diff: https://github.com/php/web-master/commit/bd2ab465530f252bc1d836bbb378c19ba5817441.diff

Handle the -noemail version of lists, too (#28)

news-web.php.net is going to use this for it's subscription forms.

Changed paths:
  M public/entry/subscribe.php

Diff:

diff --git a/public/entry/subscribe.php b/public/entry/subscribe.php
index 53ce0b7..f231503 100644
--- a/public/entry/subscribe.php
+++ b/public/entry/subscribe.php
@@ -35,9 +35,9 @@
$mail->Host = 'mailout.php.net';
$mail->Port = 25;
$mail->setFrom($_POST['email']);
-preg_match('/^(.*?)(-digest)?$/', $_POST['maillist'], $matches);
+preg_match('/^(.*?)(-digest|-nomail)?$/', $_POST['maillist'], $matches);
$maillist = $matches[1];
-$digest = count($matches) > 2 ? "-digest" : "";
+$digest = count($matches) > 2 ? $matches[2] : "";
$mail->addAddress("{$maillist}+{$_POST['request']}{$digest}@lists.php.net");
$mail->Subject = "PHP Mailing List Website Subscription";
$mail->Body = "This was a request generated from the form at {$_POST['referer']} by {$_POST['remoteip']}";