Ejemplo n.º 1
0
MAX_cookieAdd($conf['var']['viewerId'], $viewerId, _getTimeYearFromNow());
$aAdIds = MAX_Delivery_log_getArrGetVariable('adId');
$aCampaignIds = MAX_Delivery_log_getArrGetVariable('campaignId');
$aCreativeIds = MAX_Delivery_log_getArrGetVariable('creativeId');
$aZoneIds = MAX_Delivery_log_getArrGetVariable('zoneId');
// Get any ad, campaign and zone capping information from the request variables
$aCapAd['block'] = MAX_Delivery_log_getArrGetVariable('blockAd');
$aCapAd['capping'] = MAX_Delivery_log_getArrGetVariable('capAd');
$aCapAd['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapAd');
$aCapCampaign['block'] = MAX_Delivery_log_getArrGetVariable('blockCampaign');
$aCapCampaign['capping'] = MAX_Delivery_log_getArrGetVariable('capCampaign');
$aCapCampaign['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapCampaign');
$aCapZone['block'] = MAX_Delivery_log_getArrGetVariable('blockZone');
$aCapZone['capping'] = MAX_Delivery_log_getArrGetVariable('capZone');
$aCapZone['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapZone');
$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]);
Ejemplo n.º 2
0
 /**
  * A method to test the MAX_Delivery_log_getArrGetVariable() function.
  *
  * Requirements:
  * Test 1: Test with a bad config name, and ensure an empty array is returned.
  * Test 2: Test with no request value defined, and ensure an empty array is
  *         returned.
  * Test 3: Test with a request value defined, and ensure an array of that
  *         value is returned.
  * Test 4: Test with a "multiple item" request value defined, and ensure an
  *         array of the values is returned.
  */
 function test_MAX_Delivery_log_getArrGetVariable()
 {
     // Test 1
     $aReturn = MAX_Delivery_log_getArrGetVariable('foo');
     $this->assertTrue(is_array($aReturn));
     $this->assertTrue(empty($aReturn));
     // Test 2
     $conf =& $GLOBALS['_MAX']['CONF'];
     $conf['var']['blockAd'] = 'MAXBLOCK';
     unset($_GET['MAXBLOCK']);
     $aReturn = MAX_Delivery_log_getArrGetVariable('blockAd');
     $this->assertTrue(is_array($aReturn));
     $this->assertTrue(empty($aReturn));
     // Test 3
     $conf =& $GLOBALS['_MAX']['CONF'];
     $conf['var']['blockAd'] = 'MAXBLOCK';
     $_GET['MAXBLOCK'] = 1;
     $aReturn = MAX_Delivery_log_getArrGetVariable('blockAd');
     $this->assertTrue(is_array($aReturn));
     $this->assertFalse(empty($aReturn));
     $this->assertEqual(count($aReturn), 1);
     $this->assertEqual($aReturn[0], 1);
     // Test 3
     $conf =& $GLOBALS['_MAX']['CONF'];
     $conf['var']['blockAd'] = 'MAXBLOCK';
     $_GET['MAXBLOCK'] = 1 . $GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'] . 5;
     $aReturn = MAX_Delivery_log_getArrGetVariable('blockAd');
     $this->assertTrue(is_array($aReturn));
     $this->assertFalse(empty($aReturn));
     $this->assertEqual(count($aReturn), 2);
     $this->assertEqual($aReturn[0], 1);
     $this->assertEqual($aReturn[1], 5);
     // Reset the configuration
     TestEnv::restoreConfig();
 }