コード例 #1
0
 public function preProcess()
 {
     $this->_type = 'unsubscribe';
     $this->_job_id = $job_id = CRM_Utils_Request::retrieve('jid', 'Integer', $this);
     $this->_queue_id = $queue_id = CRM_Utils_Request::retrieve('qid', 'Integer', $this);
     $this->_hash = $hash = CRM_Utils_Request::retrieve('h', 'String', $this);
     if (!$job_id || !$queue_id || !$hash) {
         CRM_Core_Error::fatal(ts("Missing Parameters"));
     }
     // verify that the three numbers above match
     $q = CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
     if (!$q) {
         CRM_Core_Error::fatal(ts("There was an error in your request"));
     }
     list($displayName, $email) = CRM_Mailing_Event_BAO_Queue::getContactInfo($queue_id);
     $this->assign('display_name', $displayName);
     $emailMasked = CRM_Utils_String::maskEmail($email);
     $this->assign('email_masked', $emailMasked);
     $this->assign('email', $email);
     $this->_email = $email;
     $groups = CRM_Mailing_Event_BAO_Unsubscribe::unsub_from_mailing($job_id, $queue_id, $hash, TRUE);
     $this->assign('groups', $groups);
     $groupExist = NULL;
     foreach ($groups as $key => $value) {
         if ($value) {
             $groupExist = TRUE;
         }
     }
     if (!$groupExist) {
         $statusMsg = ts('Email: %1 has been successfully unsubscribed from this Mailing List/Group.', array(1 => $email));
         CRM_Core_Session::setStatus($statusMsg, '', 'fail');
     }
     $this->assign('groupExist', $groupExist);
 }
コード例 #2
0
ファイル: Optout.php プロジェクト: kidaa30/yes
 public function preProcess()
 {
     $this->_type = 'optout';
     $this->_job_id = $job_id = CRM_Utils_Request::retrieve('jid', 'Integer', $this);
     $this->_queue_id = $queue_id = CRM_Utils_Request::retrieve('qid', 'Integer', $this);
     $this->_hash = $hash = CRM_Utils_Request::retrieve('h', 'String', $this);
     if (!$job_id || !$queue_id || !$hash) {
         CRM_Core_Error::fatal(ts("Missing input parameters"));
     }
     // verify that the three numbers above match
     $q = CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
     if (!$q) {
         CRM_Core_Error::fatal(ts("There was an error in your request"));
     }
     list($displayName, $email) = CRM_Mailing_Event_BAO_Queue::getContactInfo($queue_id);
     $this->assign('display_name', $displayName);
     $emailMasked = CRM_Utils_String::maskEmail($email);
     $this->assign('email_masked', $emailMasked);
     $this->assign('email', $email);
     $this->_email = $email;
 }