/** TODO: test breaking on zoneid assert, chris to check function
  *
  * Populate variables from a specially encoded string.  This is used because
  * in a click URL, a parameter could possibly be another URL.
  *
  * The resulting values are set into the $_GET, and $_REQUEST globals
  */
 function test_MAX_querystringConvertParams()
 {
     $tmpGet = $_GET;
     $tmpPost = $_POST;
     $tmpCookie = $_COOKIE;
     $tmpRequest = $_REQUEST;
     $zoneid = 123;
     $campaignid = 456;
     $bannerid = 789;
     $loc = "http://www.example.com/page.html?name1=value1&name2=value2";
     $referer = "http://www.example.com/referer.php?name3=value3&name4=value4";
     $dest = "http://www.example.com/landing.php?name5=value5&nam._e6=v.__[]alue6";
     $_COOKIE = array();
     $_GET = array();
     $_POST = array();
     $_REQUEST = array();
     $this->sendMessage('test_MAX_querystring');
     $_SERVER['QUERY_STRING'] = "zoneid={$zoneid}&campaignid={$campaignid}&bannerid={$bannerid}&loc=" . urlencode($loc) . '&referer=' . urlencode($referer) . '&maxdest=' . $dest;
     MAX_querystringConvertParams();
     $this->assertEqual($_GET['zoneid'], $zoneid);
     $this->assertEqual($_GET['campaignid'], $campaignid);
     $this->assertEqual($_GET['bannerid'], $bannerid);
     $this->assertEqual($_GET['loc'], $loc);
     $this->assertEqual($_GET['referer'], $referer);
     $this->assertEqual($_GET['oadest'], $dest);
     $_COOKIE = array();
     $_GET = array();
     $_POST = array();
     $_REQUEST = array();
     $this->sendMessage('test_MAX_querystring');
     $del = $GLOBALS['_MAX']['CONF']['delivery']['ctDelimiter'];
     $_SERVER['QUERY_STRING'] = 'oaparams=' . strlen($del) . "{$del}zoneid={$zoneid}{$del}campaignid={$campaignid}{$del}bannerid={$bannerid}{$del}loc=" . urlencode($loc) . "{$del}referer=" . urlencode($referer) . "{$del}oadest={$dest}";
     MAX_querystringConvertParams();
     $this->assertEqual($_GET['zoneid'], $zoneid);
     $this->assertEqual($_GET['campaignid'], $campaignid);
     $this->assertEqual($_GET['bannerid'], $bannerid);
     $this->assertEqual($_GET['loc'], $loc);
     $this->assertEqual($_GET['referer'], $referer);
     $this->assertEqual($_GET['oadest'], $dest);
     $_COOKIE = $tmpCookie;
     $_GET = $tmpGet;
     $_POST = $tmpPost;
     $_REQUEST = $tmpRequest;
 }
Example #2
0
    $aArr = $_GET;
    // Parse the rest of the array and add to the request array.
    $aElements = explode($delim, $qs);
    foreach ($aElements as $element) {
        $len = strpos($element, '=');
        if ($len !== false) {
            $name = substr($element, 0, $len);
            $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) {