Beispiel #1
0
            $value = substr($element, $len + 1);
            $aArr[$name] = urldecode($value);
        }
    }
}
// Prevent click from being cached by browsers
MAX_commonSetNoCacheHeaders();
// Convert specially encoded params into the $_REQUEST variable
MAX_querystringConvertParams();
// Remove any special characters
MAX_commonRemoveSpecialChars($_REQUEST);
// Get the variables
$viewerId = MAX_cookieGetUniqueViewerID();
if (!empty($GLOBALS['_MAX']['COOKIE']['newViewerId']) && empty($_GET[$conf['var']['cookieTest']])) {
    // No previous cookie was found, and we have not tried to force setting one...
    MAX_cookieSetViewerIdAndRedirect($viewerId);
}
$adId = isset($_REQUEST[$conf['var']['adId']]) ? explode($GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'], $_REQUEST[$conf['var']['adId']]) : array();
$zoneId = isset($_REQUEST[$conf['var']['zoneId']]) ? explode($GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'], $_REQUEST[$conf['var']['zoneId']]) : array();
$creativeId = isset($_REQUEST[$conf['var']['creativeId']]) ? explode($GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'], $_REQUEST[$conf['var']['creativeId']]) : array();
$lastClick = isset($_REQUEST[$conf['var']['lastClick']]) ? explode($GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'], $_REQUEST[$conf['var']['lastClick']]) : array();
$aBlockLoggingClick = isset($_REQUEST[$conf['var']['blockLoggingClick']]) ? $_REQUEST[$conf['var']['blockLoggingClick']] : array();
if (empty($adId) && !empty($zoneId)) {
    foreach ($zoneId as $index => $zone) {
        $adId[$index] = _getZoneAd($zone);
        $creativeId[$index] = 0;
    }
}
for ($i = 0; $i < count($adId); $i++) {
    $adId[$i] = intval($adId[$i]);
    $zoneId[$i] = intval($zoneId[$i]);
 /**
  * This function should take a viewerID and set this in a cookie, and then send a header redirect
  * To self with the additional querystring parameter "ct=1" (cookieTest = 1) to indicate that a
  *
  */
 function test_MAX_cookieAddViewerIdAndRedirect()
 {
     $conf =& $GLOBALS['_MAX']['CONF'];
     // Disable the p3p policies because those are tested elsewhere and we need the redirect header to be [0]
     $conf['p3p']['policies'] = false;
     // Generate a clean viewerId
     unset($_COOKIE[$conf['var']['viewerId']]);
     $viewerId = MAX_cookieGetUniqueViewerID(true);
     // I know I've tested this elsewhere in the file, but sanity check that we have a valid viewerId
     $this->assertIsA($viewerId, 'string');
     $this->assertEqual(strlen($viewerId), 32);
     // Ensure that calling MAX_cookieSetViewerIdAndRedirect($viewerId) sets and flushes the viewerId cookie and redirects
     unset($GLOBALS['_HEADERS']);
     $_SERVER['SERVER_PORT'] = 80;
     $_SERVER['SCRIPT_NAME'] = 'tests/index.php';
     $_SERVER['QUERY_STRING'] = 'test=1&toast=2';
     MAX_cookieSetViewerIdAndRedirect($viewerId);
     $this->assertEqual($_COOKIE[$conf['var']['viewerId']], $viewerId);
     // Ensure that the redirect header is set
     $this->assertIsA($GLOBALS['_HEADERS'][0], 'string');
     $this->assertTrue(preg_match('#^Location: http:\\/\\/.*' . $conf['var']['cookieTest'] . '=1.*$#', $GLOBALS['_HEADERS'][0]));
 }