Пример #1
0
 public function resubscribe()
 {
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $MC = new joomlamailerMCAPI($MCapi);
     $listId = JRequest::getVar('listid', 0, 'post', 'string');
     $emails = JRequest::getVar('emails', array(), 'post', 'array');
     $i = 0;
     if (isset($emails[0]) && $listId) {
         foreach ($emails as $email) {
             $memberInfo = $MC->listMemberInfo($listId, $email);
             $resubscribe = $MC->listSubscribe($listId, $email, $memberInfo, $memberInfo['email_type'], false, true, false, false);
             if (!$MC->errorCode) {
                 $i++;
             }
         }
     }
     if ($MC->errorCode) {
         $msg = MCerrorHandler::getErrorMsg($MC);
     } else {
         $msg = $i . ' ' . JText::_('JM_USER_RESUBSCRIBED');
     }
     $this->setRedirect('index.php?option=com_joomailermailchimpintegration&view=lists', $msg);
 }
 function resubscribe()
 {
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MC = new joomlamailerMCAPI($MCapi);
     $listId = JRequest::getVar('listid', 0, 'post', 'string');
     $emails = JRequest::getVar('emails', array(), 'post', 'array');
     $i = 0;
     if (isset($emails[0]) && $listId) {
         foreach ($emails as $email) {
             $email = explode(';', $email);
             $memberInfo = $MC->listMemberInfo($listId, $email[0]);
             $resubscribe = $MC->listSubscribe($listId, $email[0], $memberInfo, $memberInfo['email_type'], false, true, false, false);
             if (!$MC->errorCode) {
                 $i++;
             }
         }
     }
     if ($MC->errorCode) {
         $msg = MCerrorHandler::getErrorMsg($MC);
     } else {
         $msg = $i . ' ' . JText::_('JM_USER_RESUBSCRIBED');
     }
     $link = 'index.php?option=com_joomailermailchimpintegration&view=joomailermailchimpintegrations';
     $this->setRedirect($link, $msg);
 }