/**
  * A method test the MAX_limitationsCheckAcl function.
  */
 function test_MAX_limitationsCheckAcl()
 {
     $source = '';
     $row['compiledlimitation'] = 'false';
     $row['acl_plugins'] = '';
     $return = MAX_limitationsCheckAcl($row, $source);
     $this->assertFalse($return);
     $row['compiledlimitation'] = 'true';
     $row['acl_plugins'] = '';
     $return = MAX_limitationsCheckAcl($row, $source);
     $this->assertTrue($return);
     // Test of dummy deliveryLimitation plugin
     $row['compiledlimitation'] = 'MAX_checkDummy_Dummy(\'1\', \'==\') and MAX_checkDummy_Dummy(\'2\', \'==\')';
     $row['acl_plugins'] = 'deliveryLimitations:Dummy:Dummy';
     $return = MAX_limitationsCheckAcl($row, $source);
     $this->assertTrue($return);
 }
Exemple #2
0
function _adSelectCheckCriteria($aAd, $aContext, $source, $richMedia)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    if (!empty($aAd['expire_time'])) {
        $expire = strtotime($aAd['expire_time']);
        $now = MAX_commonGetTimeNow();
        if ($expire > 0 && $now > $expire) {
            OX_Delivery_logMessage('Campaign has expired for bannerid ' . $aAd['ad_id'], 7);
            return false;
        }
    }
    if (isset($aContext['banner']['exclude'][$aAd['ad_id']])) {
        OX_Delivery_logMessage('List of excluded banners list contains bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (isset($aContext['campaign']['exclude'][$aAd['placement_id']])) {
        OX_Delivery_logMessage('List of excluded campaigns contains bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (isset($aContext['client']['exclude'][$aAd['client_id']])) {
        OX_Delivery_logMessage('List of excluded clients contains bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (sizeof($aContext['banner']['include']) && !isset($aContext['banner']['include'][$aAd['ad_id']])) {
        OX_Delivery_logMessage('List of included banners does not contain bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (sizeof($aContext['campaign']['include']) && !isset($aContext['campaign']['include'][$aAd['placement_id']])) {
        OX_Delivery_logMessage('List of included campaigns does not contain bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($richMedia == false && $aAd['alt_filename'] == '' && !($aAd['contenttype'] == 'jpeg' || $aAd['contenttype'] == 'gif' || $aAd['contenttype'] == 'png') && !($aAd['type'] == 'url' && $aAd['contenttype'] == '')) {
        OX_Delivery_logMessage('No alt image specified for richmedia bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (MAX_limitationsIsAdForbidden($aAd)) {
        OX_Delivery_logMessage('MAX_limitationsIsAdForbidden = true for bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($GLOBALS['_MAX']['SSL_REQUEST'] && $aAd['type'] == 'html' && $aAd['html_ssl_unsafe']) {
        OX_Delivery_logMessage('"http:" on SSL found for html bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($GLOBALS['_MAX']['SSL_REQUEST'] && $aAd['type'] == 'url' && $aAd['url_ssl_unsafe']) {
        OX_Delivery_logMessage('"http:" on SSL found in imagurl for url bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($conf['delivery']['acls'] && !MAX_limitationsCheckAcl($aAd, $source)) {
        OX_Delivery_logMessage('MAX_limitationsCheckAcl = false for bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    return true;
}
Exemple #3
0
function _adSelectCheckCriteria($aAd, $aContext, $source, $richMedia)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    // Excludelist banners
    if (isset($aContext['banner']['exclude'][$aAd['ad_id']])) {
        return false;
    }
    if (isset($aContext['campaign']['exclude'][$aAd['placement_id']])) {
        // Excludelist campaigns
        return false;
    }
    if (isset($aContext['client']['exclude'][$aAd['client_id']])) {
        // Excludelist clients
        return false;
    }
    if (sizeof($aContext['banner']['include']) && !isset($aContext['banner']['include'][$aAd['ad_id']])) {
        // Includelist banners
        return false;
    }
    if (sizeof($aContext['campaign']['include']) && !isset($aContext['campaign']['include'][$aAd['placement_id']])) {
        // Includelist campaigns
        return false;
    }
    if ($richMedia == false && $aAd['alt_filename'] == '' && !($aAd['contenttype'] == 'jpeg' || $aAd['contenttype'] == 'gif' || $aAd['contenttype'] == 'png') && !($aAd['type'] == 'url' && $aAd['contenttype'] == '')) {
        return false;
    }
    if (MAX_limitationsIsAdForbidden($aAd)) {
        // Capping & blocking
        return false;
    }
    if ($_SERVER['SERVER_PORT'] == $conf['openads']['sslPort'] && $aAd['type'] == 'html' && ($aAd['adserver'] != 'max' && $aAd['adserver'] != '3rdPartyServers:ox3rdPartyServers:max' || preg_match("#src\\s?=\\s?['\"]http:#", $aAd['htmlcache']))) {
        // HTML Banners that contain 'http:' on SSL
        return false;
    }
    if ($_SERVER['SERVER_PORT'] == $conf['openads']['sslPort'] && $aAd['type'] == 'url' && substr($aAd['imageurl'], 0, 5) == 'http:') {
        // It only matters if the initial call is to non-SSL (it can/could contain http:)
        return false;
    }
    if ($conf['delivery']['acls'] && !MAX_limitationsCheckAcl($aAd, $source)) {
        // Delivery limitations
        return false;
    }
    // If any of the above failed, this function will have already returned false
    // So to get this far means that the ad was valid
    return true;
}
/**
 * Enter description here...
 *
 * @param unknown_type $aAd
 * @param unknown_type $context
 * @param unknown_type $source
 * @param unknown_type $richMedia
 */
function _adSelectCheckCriteria($aAd, $aContext, $source, $richMedia)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    // Enforce campaign expirations
    if (!empty($aAd['expire_time'])) {
        $expire = strtotime($aAd['expire_time']);
        $now = MAX_commonGetTimeNow();
        if ($expire > 0 && $now > $expire) {
            OX_Delivery_logMessage('Campaign has expired for bannerid ' . $aAd['ad_id'], 7);
            return false;
        }
    }
    // Excludelist banners
    if (isset($aContext['banner']['exclude'][$aAd['ad_id']])) {
        OX_Delivery_logMessage('List of excluded banners list contains bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (isset($aContext['campaign']['exclude'][$aAd['placement_id']])) {
        // Excludelist campaigns
        OX_Delivery_logMessage('List of excluded campaigns contains bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (isset($aContext['client']['exclude'][$aAd['client_id']])) {
        // Excludelist clients
        OX_Delivery_logMessage('List of excluded clients contains bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (sizeof($aContext['banner']['include']) && !isset($aContext['banner']['include'][$aAd['ad_id']])) {
        // Includelist banners
        OX_Delivery_logMessage('List of included banners does not contain bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (sizeof($aContext['campaign']['include']) && !isset($aContext['campaign']['include'][$aAd['placement_id']])) {
        // Includelist campaigns
        OX_Delivery_logMessage('List of included campaigns does not contain bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($richMedia == false && $aAd['alt_filename'] == '' && !($aAd['contenttype'] == 'jpeg' || $aAd['contenttype'] == 'gif' || $aAd['contenttype'] == 'png') && !($aAd['type'] == 'url' && $aAd['contenttype'] == '')) {
        OX_Delivery_logMessage('No alt image specified for richmedia bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if (MAX_limitationsIsAdForbidden($aAd)) {
        // Capping & blocking
        OX_Delivery_logMessage('MAX_limitationsIsAdForbidden = true for bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($GLOBALS['_MAX']['SSL_REQUEST'] && $aAd['type'] == 'html' && $aAd['html_ssl_unsafe']) {
        // HTML Banners that contain 'http:' on SSL
        OX_Delivery_logMessage('"http:" on SSL found for html bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($GLOBALS['_MAX']['SSL_REQUEST'] && $aAd['type'] == 'url' && $aAd['url_ssl_unsafe']) {
        // It only matters if the initial call is to non-SSL (it can/could contain http:)
        OX_Delivery_logMessage('"http:" on SSL found in imagurl for url bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    if ($conf['delivery']['acls'] && !MAX_limitationsCheckAcl($aAd, $source)) {
        // Delivery limitations
        OX_Delivery_logMessage('MAX_limitationsCheckAcl = false for bannerid ' . $aAd['ad_id'], 7);
        return false;
    }
    // If any of the above failed, this function will have already returned false
    // So to get this far means that the ad was valid
    return true;
}
Exemple #5
0
/**
 * Enter description here...
 *
 * @param unknown_type $aAd
 * @param unknown_type $context
 * @param unknown_type $source
 * @param unknown_type $richMedia
 */
function _adSelectCheckCriteria($aAd, $aContext, $source, $richMedia)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    // Excludelist banners
    if (isset($aContext['banner']['exclude'][$aAd['ad_id']])) {
        ###START_STRIP_DELIVERY
        OA::debug('List of excluded banners list contains bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if (isset($aContext['campaign']['exclude'][$aAd['placement_id']])) {
        // Excludelist campaigns
        ###START_STRIP_DELIVERY
        OA::debug('List of excluded campaigns contains bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if (isset($aContext['client']['exclude'][$aAd['client_id']])) {
        // Excludelist clients
        ###START_STRIP_DELIVERY
        OA::debug('List of excluded clients contains bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if (sizeof($aContext['banner']['include']) && !isset($aContext['banner']['include'][$aAd['ad_id']])) {
        // Includelist banners
        ###START_STRIP_DELIVERY
        OA::debug('List of included banners does not contain bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if (sizeof($aContext['campaign']['include']) && !isset($aContext['campaign']['include'][$aAd['placement_id']])) {
        // Includelist campaigns
        ###START_STRIP_DELIVERY
        OA::debug('List of included campaigns does not contain bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if ($richMedia == false && $aAd['alt_filename'] == '' && !($aAd['contenttype'] == 'jpeg' || $aAd['contenttype'] == 'gif' || $aAd['contenttype'] == 'png') && !($aAd['type'] == 'url' && $aAd['contenttype'] == '')) {
        ###START_STRIP_DELIVERY
        OA::debug('No alt image specified for richmedia bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if (MAX_limitationsIsAdForbidden($aAd)) {
        // Capping & blocking
        ###START_STRIP_DELIVERY
        OA::debug('MAX_limitationsIsAdForbidden = true for bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if ($_SERVER['SERVER_PORT'] == $conf['openads']['sslPort'] && $aAd['type'] == 'html' && ($aAd['adserver'] != 'max' && $aAd['adserver'] != '3rdPartyServers:ox3rdPartyServers:max' || preg_match("#src\\s?=\\s?['\"]http:#", $aAd['htmlcache']))) {
        // HTML Banners that contain 'http:' on SSL
        ###START_STRIP_DELIVERY
        OA::debug('"http:" on SSL found for html bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if ($_SERVER['SERVER_PORT'] == $conf['openads']['sslPort'] && $aAd['type'] == 'url' && substr($aAd['imageurl'], 0, 5) == 'http:') {
        // It only matters if the initial call is to non-SSL (it can/could contain http:)
        ###START_STRIP_DELIVERY
        OA::debug('"http:" on SSL found in imagurl for url bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    if ($conf['delivery']['acls'] && !MAX_limitationsCheckAcl($aAd, $source)) {
        // Delivery limitations
        ###START_STRIP_DELIVERY
        OA::debug('MAX_limitationsCheckAcl = false for bannerid ' . $aAd['ad_id'] . ' ' . $aAd['name']);
        ###END_STRIP_DELIVERY
        return false;
    }
    // If any of the above failed, this function will have already returned false
    // So to get this far means that the ad was valid
    return true;
}