Esempio n. 1
0
    return '"' . $string . '"';
}
MAX_commonSetNoCacheHeaders();
MAX_commonRegisterGlobalsArray(array('layerstyle'));
if (!isset($layerstyle) || empty($layerstyle)) {
    $layerstyle = 'geocities';
}
$plugin = MAX_PATH . $conf['pluginPaths']['plugins'] . 'invocationTags/oxInvocationTags/layerstyles/' . $layerstyle . '/layerstyle.inc.php';
if (!preg_match('/^[a-z0-9-]{1,64}$/Di', $layerstyle) || !@(include $plugin)) {
    MAX_sendStatusCode(404);
    echo '// Cannot load required layerstyle file. Check if openXInvocationTags plugin is installed';
    exit;
}
MAX_commonRegisterGlobalsArray(array('block', 'blockcampaign', 'exclude', 'mmm_fo', 'q'));
if (isset($context) && !is_array($context)) {
    $context = MAX_commonUnpackContext($context);
}
if (!is_array($context)) {
    $context = array();
}
$limitations = MAX_layerGetLimitations();
MAX_commonSendContentTypeHeader("application/x-javascript", $charset);
if ($limitations['compatible']) {
    $output = MAX_adSelect($what, $campaignid, $target, $source, $withtext, $charset, $context, $limitations['richmedia'], $GLOBALS['ct0'], $GLOBALS['loc'], $GLOBALS['referer']);
    MAX_cookieFlush();
    $uniqid = substr(md5(uniqid('', 1)), 0, 8);
    if (empty($output['bannerid'])) {
        echo MAX_javascriptToHTML($output['html'], "MAX_{$uniqid}");
        exit;
    }
    if (!empty($block) && !empty($output['bannerid'])) {
function prepareCompanionBanner(&$aOutputParams, $aBanner, $zoneId = 0, $source = '', $ct0 = '', $withText = false, $logClick = true, $logView = true, $useAlt = false, $loc, $referer)
{
    // If we have a companion banner to serve
    if (isset($aBanner['vast_companion_banner_id']) && $aBanner['vast_companion_banner_id'] != 0) {
        $companionBannerId = $aBanner['vast_companion_banner_id'];
        // VAST supports the concept of an ad having multlple  companions returned(each with different formats and sizes
        // its then the role of the player to choose the appropriate companion ad to display based on users screen size etc
        // However for now we just focus on serving a single companion banner. Also in vast - I think - the player should be adding the click tracking
        // for now we are doing this server side.
        global $context;
        if (isset($context) && !is_array($context)) {
            $context = MAX_commonUnpackContext($context);
        }
        if (!is_array($context)) {
            $context = array();
        }
        $companionOutput = MAX_adSelect("bannerid:{$companionBannerId}", '', "", $source, $withText, '', $context, true, $ct0, $loc, $referer);
        //$aBanner = _adSelectDirect("bannerid:$companionBannerId", '', $context, $source);
        //$companionOutput = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false);
        //$aOutputParams['companionId'] = $companionBannerId;
        if (!empty($companionOutput['html'])) {
            // We only regard  a companion existing, if we have some markup to output
            $html = $companionOutput['html'];
            // deal with the case where the companion code itself contains a CDATA
            $html = str_replace(']]>', ']]]]><![CDATA[>', $html);
            $aOutputParams['companionMarkup'] = $html;
            $aOutputParams['companionWidth'] = $companionOutput['width'];
            $aOutputParams['companionHeight'] = $companionOutput['height'];
            $aOutputParams['companionClickUrl'] = $companionOutput['url'];
        }
    }
}