/**
  * A method to test the MAX_Delivery_log_logVariableValues() function.
  */
 function test_MAX_Delivery_log_logVariableValues()
 {
     $aConf =& $GLOBALS['_MAX']['CONF'];
     $aConf['maintenance']['operationInterval'] = 60;
     $GLOBALS['_MAX']['NOW'] = time();
     $oNowDate = new Date($GLOBALS['_MAX']['NOW']);
     // Test to ensure that the openXDeliveryLog plugin's data bucket
     // table does not exist
     $oTable = new OA_DB_Table();
     $tableExists = $oTable->extistsTable($aConf['table']['prefix'] . 'data_bkt_a_var');
     $this->assertFalse($tableExists);
     // Test calling the main logging function without any plugins installed,
     // to ensure that this does not result in any kind of error
     $aVariables = array(55 => array('variable_id' => 55, 'tracker_id' => 1, 'name' => 'fooVar', 'type' => 'string', 'variablecode' => ''), 66 => array('variable_id' => 66, 'tracker_id' => 1, 'name' => 'barVar', 'type' => 'string', 'variablecode' => ''));
     $_GET['fooVar'] = 'foo';
     $_GET['barVar'] = 'bar';
     MAX_Delivery_log_logVariableValues($aVariables, 1, 1, 'singleDB');
     // Install the openXDeliveryLog plugin
     TestEnv::installPluginPackage('openXDeliveryLog', false);
     // Test to ensure that the openXDeliveryLog plugin's data bucket
     // table now does exist
     $tableExists = $oTable->extistsTable($aConf['table']['prefix'] . 'data_bkt_a_var');
     $this->assertTrue($tableExists);
     // Ensure that there are is nothing logged in the data bucket table
     $doData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
     $doData_bkt_a_var->find();
     $rows = $doData_bkt_a_var->getRowCount();
     $this->assertEqual($rows, 0);
     // Call the variable value logging function
     MAX_Delivery_log_logVariableValues($aVariables, 1, 1, 'singleDB');
     // Ensure that the data was logged correctly
     $doData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
     $doData_bkt_a_var->find();
     $rows = $doData_bkt_a_var->getRowCount();
     $this->assertEqual($rows, 2);
     $doData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
     $doData_bkt_a_var->server_conv_id = 1;
     $doData_bkt_a_var->server_raw_ip = 'singleDB';
     $doData_bkt_a_var->tracker_variable_id = 55;
     $doData_bkt_a_var->find();
     $rows = $doData_bkt_a_var->getRowCount();
     $this->assertEqual($rows, 1);
     $doData_bkt_a_var->fetch();
     $this->assertEqual($doData_bkt_a_var->value, 'foo');
     $this->assertEqual($doData_bkt_a_var->date_time, $oNowDate->format('%Y-%m-%d %H:%M:%S'));
     // Uninstall the openXDeliveryLog plugin
     TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
     // Restore the test configuration file
     TestEnv::restoreConfig();
 }
Example #2
0
    }
    return $buffer;
}
function MAX_javascriptEncodeJsonField($string)
{
    $string = addcslashes($string, "\\/\"\n\r\t");
    $string = str_replace("", "\\b", $string);
    $string = str_replace("\f", "\\f", $string);
    return '"' . $string . '"';
}
MAX_commonSetNoCacheHeaders();
MAX_commonRegisterGlobalsArray(array('trackerid'));
if (empty($trackerid)) {
    $trackerid = 0;
}
if ($conf['logging']['trackerImpressions']) {
    $aConversion = MAX_trackerCheckForValidAction($trackerid);
    if (!empty($aConversion)) {
        $aConversionInfo = MAX_Delivery_log_logConversion($trackerid, $aConversion);
        $serverConvId = $serverRawIp = null;
        if (isset($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_conv_id'])) {
            $serverConvId = $aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_conv_id'];
        }
        if (isset($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_raw_ip'])) {
            $serverRawIp = $aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_raw_ip'];
        }
        MAX_Delivery_log_logVariableValues(MAX_cacheGetTrackerVariables($trackerid), $trackerid, $serverConvId, $serverRawIp);
    }
}
MAX_cookieFlush();
MAX_commonDisplay1x1();
Example #3
0
<?php

/*
+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
// Require the initialisation file
require_once '../../init-delivery.php';
// Required files
require_once MAX_PATH . '/lib/max/Delivery/cache.php';
// Register input variables
if (!empty($_GET['trackerid'])) {
    $trackerId = $_GET['trackerid'];
    $serverConvId = isset($_GET['server_conv_id']) ? $_GET['server_conv_id'] : null;
    $serverRawIp = isset($_GET['server_raw_ip']) ? $_GET['server_raw_ip'] : null;
    $aVariables = MAX_cacheGetTrackerVariables($trackerId);
    MAX_Delivery_log_logVariableValues($aVariables, $trackerId, $serverConvId, $serverRawIp);
}
Example #4
0
    }
    return $buffer;
}
function MAX_javascriptEncodeJsonField($string)
{
    $string = addcslashes($string, "\\/\"\n\r\t");
    $string = str_replace("", "\\b", $string);
    $string = str_replace("\f", "\\f", $string);
    return '"' . $string . '"';
}
// No Caching
MAX_commonSetNoCacheHeaders();
//Register any script specific input variables
MAX_commonRegisterGlobalsArray(array('trackerid'));
if (empty($trackerid)) {
    $trackerid = 0;
}
// Log the tracker impression
if ($conf['logging']['trackerImpressions']) {
    $aConversion = MAX_trackerCheckForValidAction($trackerid);
    if (!empty($aConversion)) {
        $aConversionInfo = MAX_Delivery_log_logConversion($trackerid, $aConversion);
        if (isset($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_conv_id'])) {
            // Store tracker impression variable values
            MAX_Delivery_log_logVariableValues(MAX_cacheGetTrackerVariables($trackerid), $trackerid, $aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_conv_id'], $aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_raw_ip']);
        }
    }
}
MAX_cookieFlush();
// Send a 1 x 1 gif
MAX_commonDisplay1x1();