Merge pull request #19463 from colemanw/removeCampaignPseudoconstant
[civicrm-core.git] / CRM / Mailing / Page / Confirm.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 class CRM_Mailing_Page_Confirm extends CRM_Core_Page {
18
19 /**
20 * @return string
21 * @throws Exception
22 */
23 public function run() {
24 CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
25
26 $contact_id = CRM_Utils_Request::retrieve('cid', 'Integer');
27 $subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer');
28 $hash = CRM_Utils_Request::retrieve('h', 'String');
29
30 if (!$contact_id ||
31 !$subscribe_id ||
32 !$hash
33 ) {
34 throw new CRM_Core_Exception(ts("Missing input parameters"));
35 }
36
37 $result = CRM_Mailing_Event_BAO_Confirm::confirm($contact_id, $subscribe_id, $hash);
38 if ($result === FALSE) {
39 $this->assign('success', $result);
40 }
41 else {
42 $this->assign('success', TRUE);
43 $this->assign('group', $result);
44 }
45
46 list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
47 $this->assign('display_name', $displayName);
48 $this->assign('email', $email);
49
50 return parent::run();
51 }
52
53 }