function view_raw($what, $clientid = 0, $target = '', $source = '', $withtext = 0, $context = 0, $richmedia = true)
{
    global $phpAds_config;
    global $phpAds_followedChain;
    // If $clientid consists of alpha-numeric chars it is
    // not the clientid, but the target parameter.
    if (!preg_match('#^[0-9]+$#', $clientid)) {
        $target = $clientid;
        $clientid = 0;
    }
    $found = false;
    // Reset followed zone chain
    $phpAds_followedChain = array();
    $first = true;
    while (($first || $what != '') && $found == false) {
        $first = false;
        if (substr($what, 0, 5) == 'zone:') {
            if (!defined('LIBVIEWZONE_INCLUDED')) {
                require phpAds_path . '/libraries/lib-view-zone.inc.php';
            }
            $row = phpAds_fetchBannerZone($what, $clientid, $context, $source, $richmedia);
        } else {
            if (!defined('LIBVIEWDIRECT_INCLUDED')) {
                require phpAds_path . '/libraries/lib-view-direct.inc.php';
            }
            $row = phpAds_fetchBannerDirect($what, $clientid, $context, $source, $richmedia);
        }
        if (is_array($row)) {
            $found = true;
        } else {
            $what = $row;
        }
    }
    if ($found) {
        // Prepare impression logging
        if ($phpAds_config['log_adviews'] && !$phpAds_config['log_beacon']) {
            phpAds_logImpression($row['bannerid'], $row['clientid'], $row['zoneid'], $source);
        }
        $row = array_merge($row, phpAds_getBannerDetails($row['bannerid']));
        return phpAds_prepareOutput($row, $target, $source, $withtext);
    } else {
        // An error occured, or there are no banners to display at all
        // Use the default banner if defined
        if ($phpAds_config['default_banner_target'] != '' && $phpAds_config['default_banner_url'] != '') {
            // Determine target
            if ($target == '') {
                $target = '_blank';
            }
            // default
            // Show default banner
            $outputbuffer = '<a href=\'' . $phpAds_config['default_banner_target'] . '\' target=\'' . $target . '\'><img src=\'' . $phpAds_config['default_banner_url'] . '\' border=\'0\' alt=\'\'></a>';
            // Return banner
            return array('html' => $outputbuffer, 'bannerid' => '');
        }
        return false;
    }
}
Ejemplo n.º 2
0
                require phpAds_path . '/libraries/lib-view-direct.inc.php';
            }
            $row = phpAds_fetchBannerDirect($what, $clientid, '', $source, false);
        }
        if (is_array($row)) {
            $found = true;
        } else {
            $what = $row;
        }
    }
} else {
    $found = false;
}
if ($found) {
    // Get the data we need to display the banner
    $row = array_merge($row, phpAds_getBannerDetails($row['bannerid']));
    // Log this impression
    if ($phpAds_config['block_adviews'] == 0 || $phpAds_config['block_adviews'] > 0 && (!isset($_COOKIE['phpAds_blockView'][$row['bannerid']]) || $_COOKIE['phpAds_blockView'][$row['bannerid']] <= time())) {
        if ($phpAds_config['log_adviews']) {
            phpAds_logImpression($row['bannerid'], $row['clientid'], $row['zoneid'], $source);
        }
        // Send block cookies
        if ($phpAds_config['block_adviews'] > 0) {
            phpAds_setCookie("phpAds_blockView[" . $row['bannerid'] . "]", time() + $phpAds_config['block_adviews'], time() + $phpAds_config['block_adviews'] + 43200);
        }
    }
    // Set delivery cookies
    phpAds_setDeliveryCookies($row);
    // Send bannerid headers
    $cookie = array();
    $cookie['bannerid'] = $row["bannerid"];
Ejemplo n.º 3
0
if (isset($zoneid) && $zoneid > 0) {
    if (!defined('LIBVIEWCACHE_INCLUDED')) {
        @(include phpAds_path . '/libraries/deliverycache/cache-' . $phpAds_config['delivery_caching'] . '.inc.php');
    }
    $cache = phpAds_cacheFetch('what=zone:' . (int) $zoneid);
    list($zoneid, , $what, $prioritysum, $chain, $prepend, $append) = $cache;
    $row['bannerid'] = (int) $bannerid;
    $row['zoneid'] = $zoneid;
    $row['prepend'] = $prepend;
    $row['append'] = $append;
} else {
    $row['bannerid'] = (int) $bannerid;
    $row['zoneid'] = 0;
}
// Get the data we need to display the banner
$details = phpAds_getBannerDetails($row['bannerid']);
// Exit if no banner was found
if (!is_array($details)) {
    die;
}
$row = array_merge($row, $details);
$output = phpAds_prepareOutput($row, '_blank', $source, false);
echo "<html>\n";
echo "<head>\n";
echo "\t<title>" . ($row['alt'] ? $row['alt'] : 'Advertisement') . "</title>\n";
if (isset($timeout) && $timeout > 0) {
    echo "<script language='JavaScript'>\n";
    echo "<!--\n";
    echo "\twindow.setTimeout(\"window.close()\", " . $timeout * 1000 . ");\n";
    echo "// -->\n";
    echo "</script>\n";