diff --git a/CRM/Mailing/Form/Optout.php b/CRM/Mailing/Form/Optout.php index 0ffd5f297570..39d5db55d7a5 100644 --- a/CRM/Mailing/Form/Optout.php +++ b/CRM/Mailing/Form/Optout.php @@ -50,13 +50,15 @@ public function preProcess() { $this->_hash = $hash = CRM_Utils_Request::retrieve('h', 'String', $this); if (!$job_id || !$queue_id || !$hash) { - throw new CRM_Core_Exception(ts("Missing input parameters")); + //throw new CRM_Core_Exception(ts("Missing input parameters")); + CRM_Utils_System::sendResponse(new \GuzzleHttp\Psr7\Response(400, [], ts("Invalid request: missing parameters") ) ); } // verify that the three numbers above match $q = CRM_Mailing_Event_BAO_MailingEventQueue::verify($job_id, $queue_id, $hash); if (!$q) { - throw new CRM_Core_Exception(ts("There was an error in your request")); + //throw new CRM_Core_Exception(ts("There was an error in your request")); + CRM_Utils_System::sendResponse(new \GuzzleHttp\Psr7\Response(400, [], ts("Invalid request: bad parameters") ) ); } list($displayName, $email) = CRM_Mailing_Event_BAO_MailingEventQueue::getContactInfo($queue_id); diff --git a/CRM/Mailing/Form/Unsubscribe.php b/CRM/Mailing/Form/Unsubscribe.php index 7b3df693e7f1..d640cbedf0e3 100644 --- a/CRM/Mailing/Form/Unsubscribe.php +++ b/CRM/Mailing/Form/Unsubscribe.php @@ -51,13 +51,15 @@ public function preProcess() { $isConfirm = CRM_Utils_Request::retrieveValue('confirm', 'Boolean', FALSE, FALSE, 'GET'); if (!$job_id || !$queue_id || !$hash) { - throw new CRM_Core_Exception(ts('Missing Parameters')); + //throw new CRM_Core_Exception(ts('Missing Parameters')); + CRM_Utils_System::sendResponse(new \GuzzleHttp\Psr7\Response(400, [], ts("Invalid request: missing parameters")) ); } // verify that the three numbers above match $q = CRM_Mailing_Event_BAO_MailingEventQueue::verify($job_id, $queue_id, $hash); if (!$q) { - throw new CRM_Core_Exception(ts("There was an error in your request")); + //throw new CRM_Core_Exception(ts("There was an error in your request")); + CRM_Utils_System::sendResponse(new \GuzzleHttp\Psr7\Response(400, [], ts("Invalid request: bad parameters")) ); } list($displayName, $email) = CRM_Mailing_Event_BAO_MailingEventQueue::getContactInfo($queue_id); diff --git a/CRM/Mailing/Page/Open.php b/CRM/Mailing/Page/Open.php index 3a2870d5adfe..42e9e58ec004 100644 --- a/CRM/Mailing/Page/Open.php +++ b/CRM/Mailing/Page/Open.php @@ -36,8 +36,9 @@ public function run() { $queue_id = CRM_Utils_Request::retrieveValue('q', 'Positive', NULL, FALSE, 'GET'); } if (!$queue_id) { - echo "Missing input parameters\n"; - exit(); + //echo "Missing input parameters\n"; + //exit(); + CRM_Utils_System::sendResponse(new \GuzzleHttp\Psr7\Response(400, [], ts("Missing input parameters") ) ); } CRM_Mailing_Event_BAO_MailingEventOpened::open($queue_id);