$aSetLastSeen = MAX_Delivery_log_getArrGetVariable('lastView'); // Loop over the ads to be logged (there may be more than one due to internal re-directs) // and log each ad, and th en set any capping cookies required $countAdIds = count($aAdIds); for ($index = 0; $index < $countAdIds; $index++) { // Ensure that each ad to be logged has campaign, creative and zone // values set, and that all values are integers MAX_Delivery_log_ensureIntegerSet($aAdIds, $index); MAX_Delivery_log_ensureIntegerSet($aCampaignIds, $index); MAX_Delivery_log_ensureIntegerSet($aCreativeIds, $index); MAX_Delivery_log_ensureIntegerSet($aZoneIds, $index); if ($aAdIds[$index] >= -1) { $adId = $aAdIds[$index]; // Log the ad impression, if required if ($GLOBALS['_MAX']['CONF']['logging']['adImpressions']) { MAX_Delivery_log_logAdImpression($adId, $aZoneIds[$index]); } if ($aAdIds[$index] == $adId) { // Set the capping cookies, if required MAX_Delivery_log_setAdLimitations($index, $aAdIds, $aCapAd); MAX_Delivery_log_setCampaignLimitations($index, $aCampaignIds, $aCapCampaign); MAX_Delivery_log_setLastAction($index, $aAdIds, $aZoneIds, $aSetLastSeen); if ($aZoneIds[$index] != 0) { MAX_Delivery_log_setZoneLimitations($index, $aZoneIds, $aCapZone); } } } } MAX_cookieFlush(); MAX_querystringConvertParams(); if (!empty($_REQUEST[$GLOBALS['_MAX']['CONF']['var']['dest']])) {
$filenameUseAltIfAvailable = _adRenderBuildFileUrl($row['aRow'], true); if (!empty($filenameUseAltIfAvailable)) { // this impression is a fallback impression (can be used in the logImpression hook) $_REQUEST[$GLOBALS['_MAX']['CONF']['var']['fallBack']] = '1'; $creativeURL = $filenameUseAltIfAvailable; } } if (empty($creativeURL)) { // otherwise this is an Image banner and we serve the banner normally $creativeURL = $row['html']; } // The call to view_raw() above will have tried to log the impression via a beacon, // but this type of ad doesn't work with beacons, so the impression must // be logged here if ($conf['logging']['adImpressions']) { MAX_Delivery_log_logAdImpression($row['bannerid'], $zoneid); } // Redirect to the banner MAX_cookieAdd($conf['var']['vars'] . "[{$n}]", serialize($cookie)); MAX_cookieFlush(); if ($row['bannerid'] == '') { if ($row['default_banner_image_url'] != '') { // Show default banner image url MAX_redirect($row['default_banner_image_url']); } else { // Show 1x1 Gif, to ensure not broken image icon is shown. MAX_commonDisplay1x1(); } } else { MAX_redirect($creativeURL); }