Merge pull request #18303 from eileenmcnaughton/event_batch
[civicrm-core.git] / CRM / Mailing / Page / Confirm.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 */
17class CRM_Mailing_Page_Confirm extends CRM_Core_Page {
7e8c8317 18
e0ef6999
EM
19 /**
20 * @return string
21 * @throws Exception
22 */
00be9182 23 public function run() {
ad03f101 24 CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
35f7561f 25
a3d827a7
CW
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');
6a488035
TO
29
30 if (!$contact_id ||
31 !$subscribe_id ||
32 !$hash
33 ) {
2a7b8221 34 throw new CRM_Core_Exception(ts("Missing input parameters"));
6a488035
TO
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 }
96025800 52
6a488035 53}