Thank you. You are now subscribed to the newsletter. +
diff --git a/proxy/config.php b/proxy/config.php index fb67519..915fee7 100644 --- a/proxy/config.php +++ b/proxy/config.php @@ -31,12 +31,12 @@ $target_open = $target_civicrm . '/sites/all/modules/civicrm/extern/open.ph $target_file = $target_civicrm . '/sites/default/files/civicrm/persist/'; $target_mail_view = $target_civicrm . '/civicrm/mailing/view'; -// target_mail_base CANNOT be "$target_civicrm . '/civicrm/mailing'", -// since these pages cannot be easily proxied. -$target_mail_base = NULL; +// Set api-key for mail subscribe/unsubscribe user +// Set to NULL/FALSE to disable the feature +$mail_subscription_user_key = NULL; // CAREFUL: only enable temporarily on debug systems. Will log all queries to given PUBLIC file -$debug = NULL; //'debug.log'; +$debug = NULL; //'debug.log'; /**************************************************************** diff --git a/proxy/mailing/confirm.php b/proxy/mailing/confirm.php index d0a3b15..8f5d55b 100644 --- a/proxy/mailing/confirm.php +++ b/proxy/mailing/confirm.php @@ -7,11 +7,10 @@ | http://www.systopia.de/ | +---------------------------------------------------------*/ -require_once "../config.php"; require_once "../proxy.php"; // see if mail open tracking is enabled -if (!$target_mail_base) civiproxy_http_error("Feature disabled", 405); +if (!$mail_subscription_user_key) civiproxy_http_error("Feature disabled", 405); // basic check civiproxy_security_check('mail-confirm'); @@ -27,4 +26,65 @@ if (empty($parameters['sid'])) civiproxy_http_error("Missing/invalid parameter ' if (empty($parameters['cid'])) civiproxy_http_error("Missing/invalid parameter 'cid'."); if (empty($parameters['h'])) civiproxy_http_error("Missing/invalid parameter 'h'."); -civiproxy_redirect($target_mail_base . '/confirm', $parameters); +// PERFORM UNSUBSCRIBE +$group_query = civicrm_api3('MailingEventConfirm', 'create', + array( 'subscribe_id' => $parameters['sid'], + 'contact_id' => $parameters['cid'], + 'hash' => $parameters['h'], + 'api_key' => $mail_subscription_user_key, + )); +if (!empty($group_query['is_error'])) { + civiproxy_http_error($group_query['error_message'], 500); +} +?> + + + + +
+ +Thank you. You will receive an email asking you to confirm your subscription.
"; } - ?>