/**
  * saved parsed infos from ezcMailObject into database
  *
  * @param $parsedResult
  */
 private function saveParsedInfos($parsedResult)
 {
     $this->setAttribute('email_from', $parsedResult['from']);
     $this->setAttribute('email_to', $parsedResult['to']);
     $this->setAttribute('email_subject', $parsedResult['subject']);
     $this->setAttribute('bounce_code', $parsedResult['error_code']);
     //$this->setAttribute( 'final_recipient', $parsedResult[ 'final_recipient' ] );
     $this->setAttribute('email_send_date', $this->convertEmailSendDateToTimestamp($parsedResult['email_send_date']));
     // if x-cjwnl-senditem hash was set in bounce mail than fetch some ez data
     if (isset($parsedResult['x-cjwnl-senditem'])) {
         $sendItemHash = $parsedResult['x-cjwnl-senditem'];
         // try to fetch edition send item object
         $sendItemObject = CjwNewsletterEditionSendItem::fetchByHash($sendItemHash, true);
         if (is_object($sendItemObject)) {
             $newsletterUserId = $sendItemObject->attribute('newsletter_user_id');
             $editionSendId = $sendItemObject->attribute('edition_send_id');
             $editionSendItemId = $sendItemObject->attribute('id');
             $this->setAttribute('newsletter_user_id', $newsletterUserId);
             $this->setAttribute('edition_send_id', $editionSendId);
             $this->setAttribute('edition_send_item_id', $editionSendItemId);
             if ($this->isBounce()) {
                 $sendItemObject->setBounced();
                 $newsletterUser = $sendItemObject->attribute('newsletter_user_object');
                 if (is_object($newsletterUser)) {
                     // bounce nl user
                     $isHardBounce = false;
                     $newsletterUser->setBounced($isHardBounce);
                 }
             }
         }
     } elseif (isset($parsedResult['x-cjwnl-user'])) {
         $newsletterUser = CjwNewsletterUser::fetchByHash($sendItemHash, true);
         if (is_object($sendItemObject)) {
             $newsletterUserId = $newsletterUser->attribute('id');
             $this->setAttribute('newsletter_user_id', $newsletterUserId);
             if ($this->isBounce()) {
                 // bounce nl user
                 $isHardBounce = false;
                 $newsletterUser->setBounced($isHardBounce);
             }
         }
     }
     CjwNewsletterLog::writeDebug('parse_result CjwNewsletterMailboxItem::saveParsedInfos', 'mailbox_item', $this->attribute('id'), $parsedResult);
     // item is parsed
     $this->setAttribute('processed', time());
     $this->store();
 }
Ejemplo n.º 2
0
        $subscriptionDataArray['last_name'] = trim($http->postVariable('Subscription_LastName'));
    }
    if ($http->hasPostVariable('Subscription_Salutation')) {
        $subscriptionDataArray['salutation'] = trim($http->postVariable('Subscription_Salutation'));
    }
    if ($http->hasPostVariable('Subscription_IdArray')) {
        $subscriptionDataArray['id_array'] = $http->postVariable('Subscription_IdArray');
    }
    if ($http->hasPostVariable('Subscription_ListArray')) {
        $subscriptionDataArray['list_array'] = $http->postVariable('Subscription_ListArray');
    }
    // $subscriptionDataArr['list_output_format_array'] = array();
    foreach ($subscriptionDataArray['id_array'] as $listId) {
        if ($http->hasPostVariable("Subscription_OutputFormatArray_{$listId}")) {
            $subscriptionDataArray['list_output_format_array'][$listId] = $http->postVariable("Subscription_OutputFormatArray_{$listId}");
        } else {
            $defaultOutputFormatId = 0;
            $subscriptionDataArray['list_output_format_array'][$listId] = array($defaultOutputFormatId);
        }
    }
    // TODO
    // required fields
    // update subscribe/ remove supscripions
    $subscriptionResultArray = CjwNewsletterSubscription::createSubscriptionByArray($subscriptionDataArray, CjwNewsletterUser::STATUS_PENDING, $subscribeOnlyMode = false, $context = 'configure');
    $tpl->setVariable('changes_saved', true);
}
$newsletterUser = CjwNewsletterUser::fetchByHash($Params['UserHash']);
$tpl->setVariable('newsletter_user', $newsletterUser);
$Result = array();
$Result['content'] = $tpl->fetch('design:newsletter/configure.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezi18n('cjw_newsletter/configure', 'Configure newsletter settings')));