Browse Source

Merge pull request #719 from Arantor/release-2.1

! Validate paid subscription emails before saving, and also make the wor...
Arantor 11 years ago
parent
commit
ffe4827f72
2 changed files with 14 additions and 1 deletions
  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 "test" 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?';