Bladeren bron

! Validate paid subscription emails before saving, and also make the wording a bit more accurate. Fixes #717

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 11 jaren geleden
bovenliggende
commit
f8fd1853af
2 gewijzigde bestanden met toevoegingen van 14 en 1 verwijderingen
  1. 13 0
      Sources/ManagePaid.php
  2. 1 1
      Themes/default/languages/ManagePaid.english.php

+ 13 - 0
Sources/ManagePaid.php

@@ -166,6 +166,19 @@ function ModifySubscriptionSettings($return_config = false)
 	{
 		checkSession();
 
+		// Check the email addresses were actually email addresses.
+		if (!empty($_POST['paid_email_to']))
+		{
+			$email_addresses = array();
+			foreach (explode(',', $_POST['paid_email_to']) as $email)
+			{
+				$email = trim($email);
+				if (!empty($email) && preg_match('~^[0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $email))
+					$email_addresses[] = $email;
+				$_POST['paid_email_to'] = implode(',', $email_addresses);
+			}
+		}
+
 		// Sort out the currency stuff.
 		if ($_POST['paid_currency'] != 'other')
 		{

+ 1 - 1
Themes/default/languages/ManagePaid.english.php

@@ -27,7 +27,7 @@ $txt['paid_enabled_desc'] = 'This must be checked for the paid subscriptions to
 $txt['paid_email'] = 'Send Notification Emails';
 $txt['paid_email_desc'] = 'Inform the admin when a subscription automatically changes.';
 $txt['paid_email_to'] = 'Email for Correspondence';
-$txt['paid_email_to_desc'] = 'Comma-separated list of addresses to email notifications to in addition to forum admins.';
+$txt['paid_email_to_desc'] = 'Comma-separated list of addresses to email to send notifications to.';
 $txt['paidsubs_test'] = 'Enable test mode';
 $txt['paidsubs_test_desc'] = 'This puts the paid subscriptions into &quot;test&quot; mode, which will, wherever possible, use sandbox payment methods in PayPal, Authorize.net etc. Do not enable unless you know what you are doing!';
 $txt['paidsubs_test_confirm'] = 'Are you sure you want to enable test mode?';