function fetchNewsletterBounceCount()
 {
     return array('result' => eZBounce::count());
 }
Ejemplo n.º 2
0
 static function removeAllBounceInformation($bounceID)
 {
     $bounceItem = eZBounce::fetch($bounceID);
     if (!$bounceItem) {
         return;
     }
     $sendItem = eZSendNewsletterItem::fetch($bounceItem->attribute('newslettersenditem_id'), true);
     if ($sendItem) {
         $subscription = eZSubscription::fetch($sendItem->attribute('subscription_id'));
         if ($subscription) {
             $subscription->setAttribute('bounce_count', 0);
             $subscription->store();
         }
         $sendItem->setAttribute('bounce_id', 0);
         $sendItem->store();
         $bounceItem->remove();
     } else {
         $bounceItem->remove();
     }
 }
 function fetchNewsletterBounceCountGroupedByAddress()
 {
     return array('result' => eZBounce::count(eZBounce::definition(), null, "DISTINCT ADDRESS"));
 }
Ejemplo n.º 4
0
function handleBounce($type, $id, $bounceType)
{
    $previousBounce = eZBounce::fetchObject(eZBounce::definition(), null, array('newslettersenditem_id' => $id, 'bounce_type' => $bounceType), true);
    if ($previousBounce) {
        //Update the bounce count for this mailling
        $previousCount = $previousBounce->attribute('bounce_count');
        $previousBounce->setAttribute('bounce_count', ++$previousCount);
        $previousBounce->setAttribute('bounce_message', $type['bounce_message']);
        $previousBounce->store();
        $sendItem = eZSendNewsletterItem::fetch($id, true);
        if ($sendItem) {
            if ($bounceType == EZSOFTBOUNCE && $previousCount < $bounceCountStop) {
                $sendItem->setAttribute('send_status', eZSendNewsletterItem::SendStatusNone);
                $sendItem->store();
            }
            $subscriptionObject = eZSubscription::fetch($sendItem->attribute('subscription_id'));
            if ($subscriptionObject) {
                $bounce_count = $subscriptionObject->attribute('bounce_count');
                $subscriptionObject->setAttribute('bounce_count', ++$bounce_count);
                $subscriptionObject->store();
            }
        }
    } else {
        //We create a new bounce entry
        $db = eZDB::instance();
        $db->begin();
        $bounceData = new eZBounce(array());
        $bounceData->store();
        $bounceData->setAttribute('address', $type['address']);
        $bounceData->setAttribute('bounce_type', $bounceType);
        $bounceData->setAttribute('bounce_count', 1);
        $bounceData->setAttribute('bounce_arrived', $type['bounce_arrived']);
        $bounceData->setAttribute('newslettersenditem_id', $id);
        $bounceData->setAttribute('bounce_message', $type['bounce_message']);
        $bounceData->store();
        $db->commit();
        //Update the sendnewsletteritem table with reference to this bounce entry
        $sendItem = eZSendNewsletterItem::fetch($id, true);
        if ($sendItem) {
            $current_bounceID = $sendItem->attribute('bounce_id');
            if ($current_bounceID == 0) {
                $sendItem->setAttribute('bounce_id', $bounceData->attribute('id'));
                $sendItem->store();
            } else {
                eZDebug::writeNotice("Bounce ID already in place", 'check_bounce');
            }
            if ($bounceType == EZSOFTBOUNCE) {
                $sendItem->setAttribute('send_status', eZSendNewsletterItem::SendStatusNone);
                $sendItem->store();
            }
            //Set the bounce count for the matching subscription_id directly in the subscription table
            $subscription_id = $sendItem->attribute('subscription_id');
            $subscriptionObject = eZSubscription::fetch($subscription_id);
            if ($subscriptionObject) {
                $bounce_count = $subscriptionObject->attribute('bounce_count');
                $subscriptionObject->setAttribute('bounce_count', ++$bounce_count);
                $subscriptionObject->store();
            }
        }
    }
}
                 }
             }
         }
     }
 }
 $MailArray = eZBounce::fetchByOffset($offset, $limit, false, "address");
 if (count($MailArray) >= 1) {
     $bounceDataArray = array();
     foreach ($MailArray as $key => $MailBounceData) {
         $mail = $MailBounceData["address"];
         $sb_c = $db->ArrayQuery("SELECT count(*) as 'softbounces' FROM ez_bouncedata WHERE address='{$mail}' and bounce_type = 0");
         $hb_c = $db->ArrayQuery("SELECT count(*) as 'hardbounces' FROM ez_bouncedata WHERE address='{$mail}' and bounce_type = 1");
         $bounceDataArray[$key]["mail"] = $mail;
         $bounceDataArray[$key]["sb_count"] = $sb_c[0]["softbounces"];
         $bounceDataArray[$key]["hb_count"] = $hb_c[0]["hardbounces"];
         $bounceDataArray[$key]["bounces"] = eZBounce::fetchListByAddress($mail);
         $bounceDataArray[$key]["bounceIDarray"] = array();
         foreach ($bounceDataArray[$key]["bounces"] as $key2 => $bounce) {
             $sendItemBounced = eZSendNewsletterItem::fetch($bounce->ID);
             array_push($bounceDataArray[$key]["bounceIDarray"], $bounce->ID);
             $subscriptionObject = eZSubscription::fetch($sendItemBounced->attribute('subscription_id'));
             if ($subscriptionObject) {
                 $bounceDataArray[$key]["subscriptions"][$key2] = $subscriptionObject;
             }
         }
     }
     $tpl->setVariable('bounce_data_array', $bounceDataArray);
 }
 $tpl->setVariable('statusNames', eZSubscription::statusNameMap());
 $Result = array();
 $Result['newsletter_menu'] = 'design:parts/content/bounce_menu.tpl';
Ejemplo n.º 6
0
//
/*! \file bounce_search.php
*/
$Module = $Params['Module'];
$extension = 'eznewsletter';
$http = eZHTTPTool::instance();
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('module', $Module);
if ($http->hasPostVariable('RemoveBounceButton')) {
    if (is_array($http->postVariable('BounceIDArray'))) {
        $bounceIDArray = $http->postVariable('BounceIDArray');
        $http->setSessionVariable('BounceIDArray', $bounceIDArray);
        $bounces = array();
        if (count($bounceIDArray) > 0) {
            foreach ($bounceIDArray as $bounceID) {
                $bounce = eZBounce::fetch($bounceID);
                $bounces[] = $bounce;
            }
        }
        $tpl->setVariable('delete_result', $bounces);
        $Result = array();
        $Result['newsletter_menu'] = 'design:parts/content/bounce_menu.tpl';
        $Result['left_menu'] = 'design:parts/content/eznewsletter_menu.tpl';
        $Result['content'] = $tpl->fetch("design:{$extension}/confirmremove_bounce_search.tpl");
        $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('eznewsletter/bounce_search', 'Bounce Search')));
        return;
    }
}
if ($http->hasPostVariable('searchString') && trim($http->postVariable('searchString')) != "") {
    $search = trim(strtolower($http->postVariable('searchString')));
    $db = eZDB::instance();