Ejemplo n.º 1
0
 /**
  * Handle all necessary operations when new agency is created
  *
  * @see DB_DataObject::insert()
  */
 function insert()
 {
     // Create account first
     $result = $this->createAccount(OA_ACCOUNT_MANAGER, $this->name);
     if (!$result) {
         return $result;
     }
     // Store data to create a user
     if (!empty($this->username) && !empty($this->password)) {
         $aUser = array('contact_name' => $this->contact, 'email_address' => $this->email, 'username' => $this->username, 'password' => $this->password, 'default_account_id' => $this->account_id);
     }
     $agencyid = parent::insert();
     if (!$agencyid) {
         return $agencyid;
     }
     // Create user if needed
     // Is this even required anymore?
     if (!empty($aUser)) {
         $this->createUser($aUser);
     }
     // Execute any components which have registered at the afterAgencyCreate hook
     $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterAgencyCreate');
     foreach ($aPlugins as $i => $id) {
         if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
             $obj->afterAgencyCreate($agencyid);
         }
     }
     return $agencyid;
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  */
 function __construct()
 {
     $this->oCacheStorePlugin =& OX_Component::factoryByComponentIdentifier($GLOBALS['_MAX']['CONF']['delivery']['cacheStorePlugin']);
     // Do not use Plugin if it's not enabled
     if ($this->oCacheStorePlugin->enabled === false) {
         $this->oCacheStorePlugin = false;
     }
 }
Ejemplo n.º 3
0
 /**
  * Returns authentication plugin
  *
  * @static
  * @param string $authType
  * @return Plugins_Authentication
  */
 static function staticGetAuthPlugin()
 {
     static $authPlugin;
     static $authPluginType;
     if (!isset($authPlugin) || $authPluginType != $authType) {
         $aConf = $GLOBALS['_MAX']['CONF'];
         if (!empty($aConf['authentication']['type'])) {
             $authType = $aConf['authentication']['type'];
             $authPlugin = OX_Component::factoryByComponentIdentifier($authType);
         }
         if (!$authPlugin) {
             // Fall back to internal
             $authType = 'none';
             $authPlugin = new Plugins_Authentication();
         }
         if (!$authPlugin) {
             OA::debug('Error while including authentication plugin and unable to fallback', PEAR_LOG_ERR);
         }
         $authPluginType = $authType;
     }
     return $authPlugin;
 }
Ejemplo n.º 4
0
 private static function init()
 {
     if (self::$initialized) {
         return;
     }
     //register UI listeners from plugins
     $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('registerUiListeners');
     foreach ($aPlugins as $i => $id) {
         if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
             if (is_callable(array($obj, 'registerUiListeners'))) {
                 $obj->registerUiListeners();
             }
         }
     }
     self::$initialized = true;
 }
Ejemplo n.º 5
0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
if ($action == OA_UPGRADE_FINISH) {
    OA_Upgrade_Login::autoLogin();
    // Execute any components which have registered at the afterLogin hook
    $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin');
    foreach ($aPlugins as $i => $id) {
        if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
            $obj->afterLogin();
        }
    }
    // Delete the cookie
    setcookie('oat', '');
    $oUpgrader->setOpenadsInstalledOn();
    if (!$oUpgrader->removeUpgradeTriggerFile()) {
        $message .= '. ' . $strRemoveUpgradeFile;
        $strInstallSuccess = '<div class="sysinfoerror">' . $strOaUpToDateCantRemove . '</div>' . $strInstallSuccess;
    }
}
if ($installStatus == OA_STATUS_OAD_NOT_INSTALLED) {
    setcookie('oat', OA_UPGRADE_INSTALL);
    $_COOKIE['oat'] = OA_UPGRADE_INSTALL;
} elseif ($installStatus !== 'unknown') {
Ejemplo n.º 6
0
 /**
  * A private method to return the appropriate report plugin, based
  * on the identifying string.
  *
  * @access private
  * @param string $reportIdentifier The string identifying the report.
  * @return Plugins_Reports The report plugin.
  */
 function _newPluginByName($reportIdentifier)
 {
     $pluginKey = explode(':', $reportIdentifier);
     $oPlugin = OX_Component::factoryByComponentIdentifier($reportIdentifier);
     return $oPlugin;
 }
Ejemplo n.º 7
0
 function _validateTargeting($oTargeting)
 {
     if (!isset($oTargeting->data)) {
         $this->raiseError('Field \'data\' in structure does not exists');
         return false;
     }
     if (!$this->checkStructureRequiredStringField($oTargeting, 'logical', 255) || !$this->checkStructureRequiredStringField($oTargeting, 'type', 255) || !$this->checkStructureRequiredStringField($oTargeting, 'comparison', 255) || !$this->checkStructureNotRequiredStringField($oTargeting, 'data')) {
         return false;
     }
     // Check that each of the specified targeting plugins are available
     $oPlugin = OX_Component::factoryByComponentIdentifier($oTargeting->type);
     if ($oPlugin === false) {
         $this->raiseError('Unknown targeting plugin: ' . $oTargeting->type);
         return false;
     }
     return true;
 }
 public function finishAction()
 {
     $oWizard = new OX_Admin_UI_Install_Wizard($this->getInstallStatus());
     $this->setCurrentStepIfReachable($oWizard, 'finish');
     $oUpgrader = $this->getUpgrader();
     $isUpgrade = $this->getInstallStatus()->isUpgrade();
     //finalize - mark OpenX as installed, clear files etc.
     $this->finalizeInstallation();
     $oStorage = OX_Admin_UI_Install_InstallUtils::getSessionStorage();
     //collect only job statuses with errors
     $aJobStatuses = $oStorage->get('aJobStatuses');
     $aStatuses = array();
     if ($aJobStatuses) {
         foreach ($aJobStatuses as $jobId => $aJobStatus) {
             //check session for job statuses
             if (!empty($aJobStatus['errors'])) {
                 $aStatuses[$jobId] = $aJobStatus;
             }
         }
     }
     $oRequest = $this->getRequest();
     if ($oRequest->isPost()) {
         $this->resetInstaller();
         global $installerIsUpgrade;
         $installerIsUpgrade = $isUpgrade;
         // Execute any components which have registered at the afterLogin hook
         $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin');
         foreach ($aPlugins as $i => $id) {
             if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
                 $obj->afterLogin();
             }
         }
         require_once LIB_PATH . '/Admin/Redirect.php';
         OX_Admin_Redirect::redirect('advertiser-index.php');
     }
     $logPath = str_replace('/', DIRECTORY_SEPARATOR, $oUpgrader->getLogFileName());
     $this->setModelProperty('logPath', $logPath);
     $this->setModelProperty('oWizard', $oWizard);
     $this->setModelProperty('aStatuses', $aStatuses);
     $this->setModelProperty('isUpgrade', $isUpgrade);
 }
Ejemplo n.º 9
0
 /**
  * Factory component by its Id
  *
  * @param string $componentId  Component Id, for example: ExtensionName:GroupName:ComponentName
  * @return OX_Component  Returns OX_Component or false on error
  */
 function _factoryComponentById($componentId)
 {
     return OX_Component::factoryByComponentIdentifier($componentId);
 }
    $aBanner['keyword'] = '';
    $aBanner["weight"] = $pref['default_banner_weight'];
    $aBanner['hardcoded_links'] = array();
    $aBanner['hardcoded_targets'] = array();
}
if ($ext_bannertype) {
    list($extension, $group, $plugin) = explode(':', $ext_bannertype);
    $oComponent =& OX_Component::factory($extension, $group, $plugin);
    if (!$oComponent) {
        $oComponent = OX_Component::getFallbackHandler($extension);
    }
    $formDisabled = !$oComponent || !$oComponent->enabled;
}
if (!$ext_bannertype && $type && !in_array($type, array('sql', 'web', 'url', 'html', 'txt'))) {
    list($extension, $group, $plugin) = explode('.', $type);
    $oComponent =& OX_Component::factoryByComponentIdentifier($extension, $group, $plugin);
    $formDisabled = !$oComponent || !$oComponent->enabled;
    if ($oComponent) {
        $ext_bannertype = $type;
        $type = $oComponent->getStorageType();
    } else {
        $ext_bannertype = '';
        $type = '';
    }
}
$show_txt = $conf['allowedBanners']['text'];
if (isset($type) && $type == "txt") {
    $show_txt = true;
}
$bannerTypes = array();
if ($show_txt) {
Ejemplo n.º 11
0
/**
 * Starts or continue existing session
 *
 * @param unknown_type $checkRedirectFunc
 */
function OA_Start($checkRedirectFunc = null)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    global $session;
    // XXX: Why not try loading session data when OpenX is not installed?
    //if ($conf['openads']['installed'])
    if (OA_INSTALLATION_STATUS == OA_INSTALLATION_STATUS_INSTALLED) {
        phpAds_SessionDataFetch();
    }
    if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) {
        // Required files
        include_once MAX_PATH . '/lib/max/language/Loader.php';
        // Load the required language files
        Language_Loader::load('default');
        phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc));
        $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin');
        foreach ($aPlugins as $i => $id) {
            if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
                $obj->afterLogin();
            }
        }
    }
    // Overwrite certain preset preferences
    if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) {
        $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language'];
    }
    // Check if manual account switch has happened and migrate to new global variable
    if (isset($session['accountSwitch'])) {
        $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch'];
        unset($session['accountSwitch']);
        phpAds_SessionDataStore();
    }
}
Ejemplo n.º 12
0
/**
 * Starts or continue existing session
 *
 * @param unknown_type $checkRedirectFunc
 */
function OA_Start($checkRedirectFunc = null)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    global $session;
    // Send no cache headers
    MAX_header('Pragma: no-cache');
    MAX_header('Cache-Control: no-cache, no-store, must-revalidate');
    MAX_header('Expires: 0');
    if (RV_INSTALLATION_STATUS == RV_INSTALLATION_STATUS_INSTALLED) {
        phpAds_SessionDataFetch();
    }
    if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) {
        // Required files
        include_once MAX_PATH . '/lib/max/language/Loader.php';
        // Load the required language files
        Language_Loader::load('default');
        phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc));
        $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin');
        foreach ($aPlugins as $i => $id) {
            if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
                $obj->afterLogin();
            }
        }
    }
    // Overwrite certain preset preferences
    if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) {
        $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language'];
    }
    // Check if manual account switch has happened and migrate to new global variable
    if (isset($session['accountSwitch'])) {
        $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch'];
        unset($session['accountSwitch']);
        phpAds_SessionDataStore();
    }
}
Ejemplo n.º 13
0
 /**
  * Place invocation form - generate form with group of options for every plugin,
  * look into max/docs/developer/plugins.zuml for more details
  *
  * @param array $extra
  * @param boolean $zone_invocation
  * @param array  $aParams          Input parameters, if null globals will be fetched
  *
  * @return string  Generated invocation form
  */
 function placeInvocationForm($extra = '', $zone_invocation = false, $aParams = null)
 {
     $this->tabindex = 1;
     global $phpAds_TextDirection;
     $conf = $GLOBALS['_MAX']['CONF'];
     $pref = $GLOBALS['_MAX']['PREF'];
     $buffer = '';
     $this->zone_invocation = $zone_invocation;
     // register all the variables
     $this->assignVariables($aParams);
     if (is_array($extra)) {
         $this->assignVariables($extra);
     }
     // Check if affiliate is on the same server as the delivery code
     if (!empty($extra['website'])) {
         $server_max = parse_url('http://' . $conf['webpath']['delivery'] . '/');
         $server_affilate = parse_url($extra['website']);
         // this code could be extremely slow if host is unresolved
         $this->server_same = @gethostbyname($server_max['host']) == @gethostbyname($server_affilate['host']);
     } else {
         $this->server_same = true;
     }
     // Hide when integrated in zone-advanced.php
     if (!is_array($extra) || !isset($extra['zoneadvanced']) || !$extra['zoneadvanced']) {
         $buffer .= "<form id='generate' name='generate' method='POST' onSubmit='return max_formValidate(this) && disableTextarea();'>\n";
     }
     // Invocation type selection
     if (!is_array($extra) || isset($extra['delivery']) && $extra['delivery'] != phpAds_ZoneInterstitial && $extra['delivery'] != phpAds_ZonePopup && $extra['delivery'] != MAX_ZoneEmail) {
         $invocationTags =& OX_Component::getComponents('invocationTags');
         $allowed = array();
         foreach ($invocationTags as $pluginKey => $invocationTag) {
             if ($invocationTag->isAllowed($extra, $this->server_same)) {
                 $aOrderedComponents[$invocationTag->getOrder()] = array('pluginKey' => $pluginKey, 'isAllowed' => $invocationTag->isAllowed($extra, $this->server_same), 'name' => $invocationTag->getName());
             }
         }
         ksort($aOrderedComponents);
         foreach ($aOrderedComponents as $order => $aComponent) {
             $allowed[$aComponent['pluginKey']] = $aComponent['isAllowed'];
         }
         if (!isset($this->codetype) || $allowed[$this->codetype] == false) {
             foreach ($allowed as $codetype => $isAllowed) {
                 $this->codetype = $codetype;
                 break;
             }
         }
         if (!isset($bannerUrl)) {
             $bannerUrl = 'http://www.example.com/INSERT_BANNER_URL.gif';
         }
         $buffer .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
         $buffer .= "<tr><td height='25' width='350'><b>" . $GLOBALS['strChooseTypeOfBannerInvocation'] . "</b>";
         if ($this->codetype == "invocationTags:oxInvocationTags:adview") {
             $buffer .= "";
         }
         $buffer .= "</td></tr><tr><td height='35' valign='top'>";
         $buffer .= "<select name='codetype' onChange=\"disableTextarea();this.form.submit()\" accesskey=" . $GLOBALS['keyList'] . " tabindex='" . $this->tabindex++ . "'>";
         $invocationTagsNames = array();
         foreach ($aOrderedComponents as $order => $aComponent) {
             $invocationTagsNames[$aComponent['pluginKey']] = $aComponent['name'];
         }
         foreach ($invocationTagsNames as $pluginKey => $invocationTagName) {
             $buffer .= "<option value='" . $pluginKey . "'" . ($this->codetype == $pluginKey ? ' selected' : '') . ">" . $invocationTagName . "</option>";
         }
         $buffer .= "</select>";
         $buffer .= "&nbsp;<input type='image' src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/go_blue.gif' border='0'></td>";
     } else {
         $invocationTags =& OX_Component::getComponents('invocationTags');
         foreach ($invocationTags as $invocationCode => $invocationTag) {
             if (isset($invocationTag->defaultZone) && $extra['delivery'] == $invocationTag->defaultZone) {
                 $this->codetype = $invocationCode;
                 break;
             }
         }
         if (!isset($this->codetype)) {
             $this->codetype = '';
         }
     }
     if ($this->codetype != '') {
         // factory plugin for this $codetype
         $invocationTag = OX_Component::factoryByComponentIdentifier($this->codetype);
         if ($invocationTag === false) {
             OA::debug('Error while factory invocationTag plugin');
             exit;
         }
         $invocationTag->setInvocation($this);
         $buffer .= "</td></tr></table>";
         $buffer .= $invocationTag->getHeaderHtml($this, $extra);
         $buffer .= $this->getTextAreaAndOptions($invocationTag, $extra);
     }
     // Put extra hidden fields
     if (is_array($extra)) {
         reset($extra);
         while (list($k, $v) = each($extra)) {
             $buffer .= "<input type='hidden' value='" . htmlspecialchars($v, ENT_QUOTES) . "' name='{$k}'>";
         }
     }
     // Hide when integrated in zone-advanced.php
     if (!is_array($extra) || !isset($extra['zoneadvanced']) || !$extra['zoneadvanced']) {
         $buffer .= "</form><br /><br />";
     }
     // Disable bannercode before submitting the form (causes problems with mod_security)
     $buffer .= "<script type='text/javascript'>\n            function disableTextarea() {\n                var form = findObj('generate');\n                if (typeof(form.bannercode) != 'undefined') {\n                    form.bannercode.disabled = true;\n                }\n                form.submit();\n            }\n            </script>\n        ";
     return $buffer;
 }
Ejemplo n.º 14
0
function phpAds_getBannerCache($banner)
{
    $aConf = $GLOBALS['_MAX']['CONF'];
    $aPref = $GLOBALS['_MAX']['PREF'];
    $buffer = $banner['htmltemplate'];
    // Strip slashes from urls
    $banner['url'] = stripslashes($banner['url']);
    $banner['imageurl'] = stripslashes($banner['imageurl']);
    // The following properties depend on data from the invocation process
    // and can't yet be determined: {zoneid}, {bannerid}
    // These properties will be set during invocation
    // Auto change HTML banner
    if ($banner['storagetype'] == 'html') {
        if ($buffer != '') {
            // Remove target parameters
            // The regexp should handle ", ', \", \' as delimiters
            $buffer = preg_replace('# target\\s*=\\s*(\\\\?[\'"]).*?\\1#i', ' ', $buffer);
            // Put our click URL and our target parameter in all anchors...
            // The regexp should handle ", ', \", \' as delimiters
            $buffer = preg_replace('#<a(.*?)href\\s*=\\s*(\\\\?[\'"])http(.*?)\\2(.*?) *>#is', "<a\$1href=\$2{clickurl}http\$3\$2\$4  target=\$2{target}\$2>", $buffer);
            // Search: <\s*form (.*?)action\s*=\s*['"](.*?)['"](.*?)>
            // Replace:<form\1 action="{url_prefix}/{$aConf['file']['click']}" \3><input type='hidden' name='{clickurlparams}\2'>
            $target = !empty($banner['target']) ? $banner['target'] : "_self";
            // strip out the method from any <forms> these will be changed to GET
            $buffer = preg_replace('#<\\s*form (.*?)method\\s*=\\s*[\\\\]?[\'"](.*?)[\'"]#is', "<form \$1 method='GET'", $buffer);
            $buffer = preg_replace('#<\\s*form (.*?)action\\s*=\\s*[\\\\]?[\'"](.*?)[\'\\\\"][\'\\\\"]?(.*?)>(.*?)</form>#is', "<form \$1 action='{url_prefix}/{$aConf['file']['click']}' \$3 target='{$target}'>\$4<input type='hidden' name='{$aConf['var']['params']}' value='{clickurlparams}\$2'></form>", $buffer);
            //$buffer = preg_replace("#<form*action='*'*>#i","<form target='{target}' $1action='{url_prefix}/{}$aConf['file']['click']'$3><input type='hidden' name='{clickurlparams}$2'>", $buffer);
            //$buffer = preg_replace("#<form*action=\"*\"*>#i","<form target=\"{target}\" $1action=\"{url_prefix}/{$aConf['file']['click']}\"$3><input type=\"hidden\" name=\"{clickurlparams}$2\">", $buffer);
            // In addition, we need to add our clickURL to the clickTAG parameter if present, for 3rd party flash ads
            $buffer = preg_replace('#clickTAG\\s?=\\s?(.*?)([\'"])#', "clickTAG={clickurl}\$1\$2", $buffer);
            // Detect any JavaScript window.open() functions, and prepend the opened URL with our logurl
            $buffer = preg_replace('#window.open\\s?\\((.*?)\\)#i', "window.open(\\\\'{logurl}&maxdest=\\\\'+\$1)", $buffer);
        }
        // Since we don't want to replace adserver noscript and iframe content with click tracking etc
        $noScript = array();
        //Capture noscript content into $noScript[0], for seperate translations
        preg_match("#<noscript>(.*?)</noscript>#is", $buffer, $noScript);
        $buffer = preg_replace("#<noscript>(.*?)</noscript>#is", '{noscript}', $buffer);
        // run 3rd party component
        if (!empty($banner['adserver'])) {
            require_once LIB_PATH . '/Plugin/Component.php';
            /**
             * @todo This entire function should be relocated to the DLL and should be object-ified
             *
             */
            PEAR::pushErrorHandling(null);
            $adServerComponent = OX_Component::factoryByComponentIdentifier($banner['adserver']);
            PEAR::popErrorHandling();
            if ($adServerComponent) {
                $buffer = $adServerComponent->getBannerCache($buffer, $noScript);
            } else {
                $GLOBALS['_MAX']['bannerrebuild']['errors'] = true;
            }
        }
        // Wrap the banner inside a link if it doesn't seem to handle clicks itself
        if (!empty($banner['url']) && !preg_match('#<(a|area|form|script|object|iframe) #i', $buffer)) {
            $buffer = '<a href="{clickurl}" target="{target}">' . $buffer . '</a>';
        }
        // Adserver processing complete, now replace the noscript values back:
        //$buffer = preg_replace("#{noframe}#", $noFrame[2], $buffer);
        if (isset($noScript[0])) {
            $buffer = preg_replace("#{noscript}#", $noScript[0], $buffer);
        }
    }
    return $buffer;
}
Ejemplo n.º 15
0
 /**
  * Place invocation form - generate form with group of options for every plugin,
  * look into max/docs/developer/plugins.zuml for more details
  *
  * @param array $extra
  * @param boolean $zone_invocation
  *
  * @return string  Generated invocation form
  */
 function placeInvocationForm($extra = '', $zone_invocation = false)
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $pref = $GLOBALS['_MAX']['PREF'];
     $globalVariables = array('affiliateid', 'codetype', 'size', 'text', 'dest');
     $buffer = '';
     $this->zone_invocation = $zone_invocation;
     foreach ($globalVariables as $makeMeGlobal) {
         global ${$makeMeGlobal};
         // also make this variable a class attribute
         // so plugins could have an access to these values and modify them
         $this->{$makeMeGlobal} =& ${$makeMeGlobal};
     }
     $invocationTypes =& OX_Component::getComponents('invocationTags');
     foreach ($invocationTypes as $pluginKey => $invocationType) {
         if (!empty($invocationType->publisherPlugin)) {
             $available[$pluginKey] = $invocationType->publisherPlugin;
             $names[$pluginKey] = $invocationType->getName();
             if (!empty($invocationType->default)) {
                 $defaultPublisherPlugin = $pluginKey;
             }
         }
     }
     $affiliateid = $this->affiliateid;
     if (count($available) == 1) {
         // Only one publisher invocation plugin available
         $codetype = $defaultPublisherPlugin;
     } elseif (count($available) > 1) {
         // Multiple publisher invocation plugins available
         if (is_null($codetype)) {
             $codetype = $defaultPublisherPlugin;
         }
         echo "<form name='generate' action='" . $_SERVER['PHP_SELF'] . "' method='POST' onSubmit='return max_formValidate(this);'>\n";
         // Show the publisher invocation selection drop down
         echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
         echo "<input type='hidden' name='affiliateid' value='{$affiliateid}'>";
         echo "<tr><td height='25' colspan='3'><b>" . $GLOBALS['strChooseTypeOfInvocation'] . "</b></td></tr>";
         echo "<tr><td height='35'>";
         echo "<select name='codetype' onChange=\"this.form.submit()\" accesskey=" . $GLOBALS['keyList'] . " tabindex='" . $tabindex++ . "'>";
         foreach ($names as $pluginKey => $invocationTypeName) {
             echo "<option value='" . $pluginKey . "'" . ($codetype == $pluginKey ? ' selected' : '') . ">" . $invocationTypeName . "</option>";
         }
         echo "</select>";
         echo "&nbsp;<input type='image' src='" . OX::assetPath() . "/images/" . $GLOBALS['phpAds_TextDirection'] . "/go_blue.gif' border='0'>";
         echo "</td></tr></table>";
         echo "</form>";
         echo phpAds_ShowBreak($print = false);
         echo "<br />";
     } else {
         // No publisher invocation plugins available
         $code = 'Error: No publisher invocation plugins available';
         return;
     }
     if (!empty($codetype)) {
         $invocationTag = OX_Component::factoryByComponentIdentifier($codetype);
         if ($invocationTag === false) {
             OA::debug('Error while factory invocationTag plugin');
             exit;
         }
         $code = $this->generateInvocationCode($invocationTag);
     }
     $previewURL = MAX::constructURL(MAX_URL_ADMIN, "affiliate-preview.php?affiliateid={$affiliateid}&codetype={$codetype}");
     foreach ($invocationTag->defaultOptionValues as $feature => $value) {
         if ($invocationTag->maxInvocation->{$feature} != $value) {
             $previewURL .= "&{$feature}=" . rawurlencode($invocationTag->maxInvocation->{$feature});
         }
     }
     foreach ($this->defaultOptionValues as $feature => $value) {
         if ($this->{$feature} != $value) {
             $previewURL .= "&{$feature}=" . rawurlencode($this->{$feature});
         }
     }
     echo "<form name='generate' action='" . $previewURL . "' method='get' target='_blank'>\n";
     echo "<input type='hidden' name='codetype' value='" . $codetype . "' />";
     // Show parameters for the publisher invocation list
     echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
     echo "<tr><td height='25' colspan='3'><img src='" . OX::assetPath() . "/images/icon-overview.gif' align='absmiddle'>&nbsp;<b>" . $GLOBALS['strParameters'] . "</b></td></tr>";
     echo "<tr height='1'><td width='30'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='30'></td>";
     echo "<td width='200'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='200'></td>";
     echo "<td width='100%'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
     echo $invocationTag->generateOptions($this);
     echo "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
     //echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
     echo "</table>";
     // Pass in current values
     echo "<input type='hidden' name='affiliateid' value='{$affiliateid}' />";
     echo "<input type='submit' value='" . $GLOBALS['strGenerate'] . "' name='submitbutton' tabindex='" . $tabindex++ . "'>";
     echo "</form>";
 }
Ejemplo n.º 16
0
 private static function callAccessHook($entityTable, $entityId, $operationAccessType = self::OPERATION_ALL, $accountId = null, $accountType = null)
 {
     static $componentCache;
     /*
      * Normally we would expect plugins to return true or false here.
      * Problem arises if plugins create own entities which they protect
      * and what should happen when such plugin is disabled and entities remain.
      *
      * Solution used here is that plugin should return true/false only for entities
      * it's interested in and NULL for entities that it is ignoring.
      *
      * If, after asking all plugins, result is NULL, that means there's no plugin
      * active for such entity and if it's type is different from DEFAULT_SYSTEM it should
      * be protected.
      */
     $hasAccess = NULL;
     //ignore by default
     $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('objectAccess');
     foreach ($aPlugins as $i => $id) {
         $obj = $componentCache[$id];
         if (!isset($obj)) {
             $obj = OX_Component::factoryByComponentIdentifier($id);
             $componentCache[$id] = $obj;
         }
         if ($obj) {
             $pluginResult = $obj->hasAccessToObject($entityTable, $entityId, $operationAccessType, $accountId, $accountType);
             /*
              * Ignore NULL responses from plugins and update has access only
              * if plugin was interested in the entity
              */
             $hasAccess = $pluginResult === NULL ? $hasAccess : $pluginResult;
             if ($hasAccess === false) {
                 //break on first plugin denying access
                 break;
             }
         }
     }
     //securing non-system entities if no plugin responsible found
     if ($hasAccess === NULL && !empty($entityId) && ('clients' == $entityTable || 'campaigns' == $entityTable || 'banners' == $entityTable)) {
         $do = OA_Dal::factoryDO($entityTable);
         $aEntity = null;
         if ($do->get($entityId)) {
             $aEntity = $do->toArray();
         }
         switch ($entityTable) {
             case 'clients':
                 $hasAccess = $aEntity['type'] == DataObjects_Clients::ADVERTISER_TYPE_DEFAULT;
                 break;
             case 'campaigns':
                 $hasAccess = $aEntity['type'] == DataObjects_Campaigns::CAMPAIGN_TYPE_DEFAULT;
                 break;
             case 'banners':
                 $hasAccess = $aEntity['ext_bannertype'] != DataObjects_Banners::BANNER_TYPE_MARKET;
                 break;
         }
     }
     return $hasAccess === NULL ? true : $hasAccess;
 }
Ejemplo n.º 17
0
if (!isset($GLOBALS['_MAX']['FILES']['/lib/max/Delivery/remotehost.php'])) {
    // Required by PHP5.1.2
    require_once MAX_PATH . '/lib/max/Delivery/remotehost.php';
}
// Initialize the client info to enable client targeting options
MAX_remotehostProxyLookup();
MAX_remotehostReverseLookup();
//MAX_remotehostSetClientInfo();  // moved to plugin
MAX_remotehostSetGeoInfo();
/**
 * @todo I believe the following is unnecessary with the "MAX_remotehostSetGeoInfo()" above
 * However the isAllowed() methods for the Geo-Plugins will have to be updated
 */
// Register the geotargeting information if necessary
if (!isset($GLOBALS['_MAX']['GEO_DATA']) && (!empty($conf['geotargeting']['type']) && $conf['geotargeting']['type'] != 'none')) {
    $oGeoComponent = OX_Component::factoryByComponentIdentifier($conf['geotargeting']['type']);
    // Get geotargeting info
    if ($oGeoComponent) {
        // Set the geotargeting IP to the fixed test address
        // (IP Address used to determine which (if any) MaxMind databases are installed)
        $GLOBALS['_MAX']['GEO_IP'] = '24.24.24.24';
        // Get the geotargeting config
        $geoTargetingType = $oGeoPlugin->name;
        // Look up the Geotargeting data
        $GLOBALS['_MAX']['GEO_DATA'] = $oGeoComponent->getGeoInfo();
    }
}
function MAX_AclAdjust($acl, $action)
{
    $count = count($acl);
    if (!empty($action['new']) && !empty($_REQUEST['type'])) {
Ejemplo n.º 18
0
 /**
  * The method to run the Maintenance Priority process.
  *
  * @return boolean True if the MPE ran correctly, false otherwise.
  */
 function updatePriorities()
 {
     // Run the required tasks
     // TODO: OA_Task::run should really return a boolean we could check here.
     $this->oTaskRunner->runTasks();
     // addMaintenancePriorityTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $obj->afterMpe();
             }
         }
     }
 }
Ejemplo n.º 19
0
 function delete($useWhere = false, $cascade = true, $parentid = null)
 {
     // Find acls which use this channels
     $dalAcls = OA_Dal::factoryDAL('acls');
     $rsChannel = $dalAcls->getAclsByDataValueType($this->channelid, 'Site:Channel');
     $rsChannel->reset();
     while ($rsChannel->next()) {
         // Get the IDs of the banner that's using this channel
         $bannerId = $rsChannel->get('bannerid');
         // Get the remaining channels the banner will use, if any
         $aChannelIds = explode(',', $rsChannel->get('data'));
         $aChannelIds = array_diff($aChannelIds, array($this->channelid));
         // Prepare to update the banner's limitations in the "acls" table
         $doAcls = DB_DataObject::factory('acls');
         $doAcls->init();
         $doAcls->bannerid = $bannerId;
         $doAcls->executionorder = $rsChannel->get('executionorder');
         if (!empty($aChannelIds)) {
             $doAcls->data = implode(',', $aChannelIds);
             $doAcls->update();
         } else {
             $doAcls->delete();
         }
         // Re-compile the banner's limitations
         $aAcls = array();
         $doAcls = DB_DataObject::factory('acls');
         $doAcls->init();
         $doAcls->bannerid = $bannerId;
         $doAcls->orderBy('executionorder');
         $doAcls->find();
         while ($doAcls->fetch()) {
             $aData = $doAcls->toArray();
             $deliveryLimitationPlugin = OX_Component::factoryByComponentIdentifier('deliveryLimitations:' . $aData['type']);
             if ($deliveryLimitationPlugin) {
                 $deliveryLimitationPlugin->init($aData);
                 if ($deliveryLimitationPlugin->isAllowed($page)) {
                     $aAcls[$aData['executionorder']] = $aData;
                 }
             }
         }
         $sLimitation = MAX_AclGetCompiled($aAcls, $page);
         // TODO: it should be done inside plugins instead, there is no need to slash the data
         $sLimitation = !get_magic_quotes_runtime() ? stripslashes($sLimitation) : $sLimitation;
         $doBanners = OA_Dal::factoryDO('banners');
         $doBanners->bannerid = $bannerId;
         $doBanners->find();
         $doBanners->fetch();
         $doBanners->acl_plugins = MAX_AclGetPlugins($aAcls);
         $doBanners->acls_updated = OA::getNow();
         $doBanners->compiledlimitation = $sLimitation;
         $doBanners->update();
     }
     return parent::delete($useWhere, $cascade, $parentid);
 }
Ejemplo n.º 20
0
 /**
  * The method to run the Maintenance Statistics Engine process.
  *
  * @static
  */
 function run()
 {
     OA::switchLogIdent('maintenance');
     // Get the configuration
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Log the start of the process
     OA::debug('Running Maintenance Statistics Engine', PEAR_LOG_INFO);
     // Set longer time out, and ignore user abort
     if (!ini_get('safe_mode')) {
         @set_time_limit($aConf['maintenance']['timeLimitScripts']);
         @ignore_user_abort(true);
     }
     // Run the following code as the "Maintenance" user
     OA_Permission::switchToSystemProcessUser('Maintenance');
     // Ensure the the current time is registered with the OA_ServiceLocator
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oDate =& $oServiceLocator->get('now');
     if (!$oDate) {
         // Record the current time, and register with the OA_ServiceLocator
         $oDate = new Date();
         $oServiceLocator->register('now', $oDate);
     }
     $this->aComponents = OX_Component::getListOfRegisteredComponentsForHook('addMaintenanceStatisticsTask');
     // addMaintenanceStatisticsTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $obj->beforeMse();
             }
         }
     }
     // Initialise the task runner object, for storing/running the tasks
     $this->oTaskRunner = new OA_Task_Runner();
     // Register this object as the controlling class for the process,
     // so that tasks run by the task runner can locate this class to
     // update the report, etc.
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $this);
     // Create and register an instance of the OA_Dal_Maintenance_Statistics DAL
     // class for the following tasks to use
     if (!$oServiceLocator->get('OX_Dal_Maintenance_Statistics')) {
         $oFactory = new OX_Dal_Maintenance_Statistics_Factory();
         $oDal = $oFactory->factory();
         $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     }
     // Add the task to set the update requirements
     $oSetUpdateRequirements = new OX_Maintenance_Statistics_Task_SetUpdateRequirements();
     $this->oTaskRunner->addTask($oSetUpdateRequirements);
     // Add the task to migrate the bucket data into the statistics tables
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $this->oTaskRunner->addTask($oSummariseIntermediate);
     // Add the task to handle the de-duplication and rejection of empty conversions
     $oDeDuplicateConversions = new OX_Maintenance_Statistics_Task_DeDuplicateConversions();
     $this->oTaskRunner->addTask($oDeDuplicateConversions);
     // Add the task to handle the updating of "intermediate" statistics with
     // conversion information, as a legacy issue until all code obtains
     // conversion data from the standard conversion statistics tables
     $oManageConversions = new OX_Maintenance_Statistics_Task_ManageConversions();
     $this->oTaskRunner->addTask($oManageConversions);
     // Add the task to summarise the intermediate statistics into final form
     $oSummariseFinal = new OX_Maintenance_Statistics_Task_SummariseFinal();
     $this->oTaskRunner->addTask($oSummariseFinal);
     // Add the task to log the completion of the task
     $oLogCompletion = new OX_Maintenance_Statistics_Task_LogCompletion();
     $this->oTaskRunner->addTask($oLogCompletion);
     // Add the task to manage (enable/disable) campaigns
     $oManageCampaigns = new OX_Maintenance_Statistics_Task_ManageCampaigns();
     $this->oTaskRunner->addTask($oManageCampaigns);
     // addMaintenanceStatisticsTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $this->oTaskRunner->addTask($obj->addMaintenanceStatisticsTask(), $obj->getExistingClassName(), $obj->getOrder());
             }
         }
     }
     // Run the MSE process tasks
     $this->oTaskRunner->runTasks();
     // addMaintenanceStatisticsTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $obj->afterMse();
             }
         }
     }
     // Return to the "normal" user
     OA_Permission::switchToSystemProcessUser();
     // Log the end of the process
     OA::debug('Maintenance Statistics Engine Completed (Started at ' . $oDate->format('%Y-%m-%d %H:%M:%S') . ' ' . $oDate->tz->getShortName() . ')', PEAR_LOG_INFO);
     OA::switchLogIdent();
 }
Ejemplo n.º 21
0
 /**
  * Prepare data before generating the invocation code
  *
  * @param array $aComments Array of comments allowed keys: 'Cache Buster Comment', 'Third Party Comment',
  *                                     'SSL Delivery Comment', 'SSL Backup Comment', 'Comment'
  *
  */
 function prepareCommonInvocationData($aComments)
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     // Check if affiliate is on the same server
     if (isset($mi->website) && $mi->website != '') {
         $mi->server_max = parse_url('http://' . $conf['webpath']['delivery'] . '/');
         $mi->server_affilate = parse_url($mi->website);
         $mi->server_same = @gethostbyname($mi->server_max['host']) == @gethostbyname($mi->server_affilate['host']);
     } else {
         $mi->server_same = true;
     }
     $mi->macros = array('cachebuster' => 'INSERT_RANDOM_NUMBER_HERE', 'clickurl' => 'INSERT_ENCODED_CLICKURL_HERE');
     if (!empty($mi->thirdpartytrack) && $mi->thirdpartytrack != 'generic') {
         if ($thirdpartyserver = OX_Component::factoryByComponentIdentifier($mi->thirdpartytrack)) {
             $thirdpartyname = $thirdpartyserver->getName();
             if (!empty($thirdpartyserver->clickurlMacro)) {
                 $mi->macros['clickurl'] = $thirdpartyserver->clickurlMacro;
             }
             if (!empty($thirdpartyserver->cachebusterMacro)) {
                 $mi->macros['cachebuster'] = $thirdpartyserver->cachebusterMacro;
             }
         }
     }
     $mi->parameters = array();
     $imgParams = array();
     // Setup option defaults
     $pluginOptions = new Plugins_InvocationTagsOptions();
     foreach ($pluginOptions->defaultValues as $key => $value) {
         if (!is_array($value) && (!isset($mi->{$key}) || is_null($mi->{$key}))) {
             $mi->{$key} = $mi->parameters[$key] = $value;
         }
     }
     // UniqueID is only necessary for a couple of plugins, so it is not "common"
     //$mi->uniqueid = 'a'.substr(md5(uniqid('', 1)), 0, 7);
     if (!isset($mi->withtext)) {
         $mi->withtext = 0;
     }
     // Set parameters
     if (isset($mi->clientid) && strlen($mi->clientid) && $mi->clientid != '0') {
         $mi->parameters['clientid'] = $this->options['clientid'] = $imgParams['clientid'] = "clientid=" . $mi->clientid;
     }
     if (isset($mi->zoneid) && $mi->zoneid != '') {
         $mi->parameters['zoneid'] = $this->options['zoneid'] = $imgParams['zoneid'] = "zoneid=" . urlencode($mi->zoneid);
     }
     if (isset($mi->campaignid) && strlen($mi->campaignid) && $mi->campaignid != '0') {
         $mi->parameters['campaignid'] = $this->options['campaignid'] = $imgParams['campaignid'] = "campaignid=" . $mi->campaignid;
     }
     if (isset($mi->bannerid) && $mi->bannerid != '') {
         $mi->parameters['bannerid'] = $this->options['bannerid'] = $imgParams['bannerid'] = "bannerid=" . urlencode($mi->bannerid);
     }
     if (isset($mi->what) && $mi->what != '') {
         $mi->parameters['what'] = $this->options['what'] = $imgParams['what'] = "what=" . str_replace(",+", ",_", $mi->what);
     }
     if (isset($mi->source) && $mi->source != '') {
         $mi->parameters['source'] = $this->options['source'] = $imgParams['source'] = "source=" . urlencode($mi->source);
     }
     if (isset($mi->target) && $mi->target != '') {
         $mi->parameters['target'] = $this->options['target'] = $imgParams['target'] = "target=" . urlencode($mi->target);
     }
     if (isset($mi->charset) && $mi->charset != '') {
         $mi->parameters['charset'] = $this->options['charset'] = $imgParams['charset'] = "charset=" . urlencode($mi->charset);
     }
     if (!empty($mi->cachebuster)) {
         $mi->parameters['cb'] = $this->options['cb'] = $imgParams['cb'] = "cb=" . $mi->macros['cachebuster'];
     }
     if (!empty($mi->thirdpartytrack)) {
         $mi->parameters['ct0'] = $this->options['ct0'] = $imgParams['ct0'] = "ct0=" . $mi->macros['clickurl'];
     }
     // Set $mi->buffer to the initial comment
     $name = PRODUCT_NAME;
     if (!empty($GLOBALS['_MAX']['CONF']['ui']['applicationName'])) {
         $name = $GLOBALS['_MAX']['CONF']['ui']['applicationName'];
     }
     $buffer = "<!--/*\n  *\n  * " . $name . " " . $this->getName() . "\n  * - Generated with " . PRODUCT_NAME . " v" . VERSION . "\n";
     if (!empty($thirdpartyname)) {
         $buffer .= "  * - " . $thirdpartyname . "\n";
     }
     $buffer .= "  *\n  */-->\n\n";
     if (!empty($mi->comments)) {
         $oTrans = new OX_Translation();
         $comment = '';
         if (!empty($mi->cachebuster) && ($mi->thirdpartytrack == 'generic' || $mi->thirdpartytrack === 0)) {
             if (isset($aComments['Cache Buster Comment'])) {
                 $cbComment = $aComments['Cache Buster Comment'];
             } else {
                 $cbComment = $GLOBALS['strCacheBusterComment'];
             }
             $comment .= str_replace('{random}', $mi->macros['cachebuster'], $cbComment);
         }
         if (isset($mi->thirdpartytrack) && ($mi->thirdpartytrack == 'generic' || $mi->thirdpartytrack === 0)) {
             if (isset($aComments['Third Party Comment'])) {
                 $clickurlComment = $aComments['Third Party Comment'];
             } else {
                 $clickurlComment = $GLOBALS['strThirdPartyComment'];
             }
             $clickurlComment = $aComments['Third Party Comment'];
             $comment .= str_replace('{clickurl}', $mi->macros['clickurl'], $clickurlComment);
         }
         //SSL Delivery Comment
         if (isset($aComments['SSL Delivery Comment'])) {
             $comment .= $aComments['SSL Delivery Comment'];
         } else {
             $comment .= $oTrans->translate('SSLDeliveryComment', array($conf['webpath']['delivery'], $conf['webpath']['deliverySSL']));
         }
         if (isset($aComments['SSL Backup Comment'])) {
             $comment .= $aComments['SSL Backup Comment'];
         } else {
             $comment .= $oTrans->translate('SSLBackupComment', array($conf['webpath']['delivery'], $conf['webpath']['deliverySSL']));
         }
         if (isset($aComments['Comment'])) {
             $comment .= $aComments['Comment'];
         }
         if ($comment != '') {
             $buffer .= "<!--/*" . $comment . "\n  */-->\n\n";
         }
     }
     $mi->buffer = $buffer;
     // Set $mi->backupImage to the HTML for the backup image (same as used by adview)
     $hrefParams = array();
     $uniqueid = 'a' . substr(md5(uniqid('', 1)), 0, 7);
     if (isset($mi->bannerid) && $mi->bannerid != '') {
         $hrefParams[] = "bannerid=" . $mi->bannerid;
         $hrefParams[] = "zoneid=" . $mi->zoneid;
     } else {
         $hrefParams[] = "n=" . $uniqueid;
         $imgParams[] = "n=" . $uniqueid;
     }
     if (!empty($mi->cachebuster) || !isset($mi->cachebuster)) {
         $hrefParams[] = "cb=" . $mi->macros['cachebuster'];
     }
     // Make sure that ct0= is the last element in the array
     unset($imgParams['ct0']);
     if (!empty($mi->thirdpartytrack)) {
         $imgParams[] = "ct0=" . $mi->macros['clickurl'];
     }
     $backup = "<a href='" . MAX_commonConstructDeliveryUrl($conf['file']['click']) . "?" . implode("&amp;", $hrefParams) . "'";
     if (isset($mi->target) && $mi->target != '') {
         $backup .= " target='" . $mi->target . "'";
     } else {
         $backup .= " target='_blank'";
     }
     $backup .= "><img src='" . MAX_commonConstructDeliveryUrl($conf['file']['view']);
     // Remove any paramaters that should not be passed into the IMG call
     unset($imgParams['target']);
     if (sizeof($imgParams) > 0) {
         $backup .= "?" . implode("&amp;", $imgParams);
     }
     $backup .= "' border='0' alt='' /></a>";
     $mi->backupImage = $backup;
     // Make sure that the parameters being added are accepted by this plugin, else remove them
     foreach ($mi->parameters as $key => $value) {
         if (!in_array($key, array_keys($this->options))) {
             unset($mi->parameters[$key]);
         }
     }
 }
Ejemplo n.º 22
0
 function test_callOnComponents()
 {
     $GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] = '/lib/OX/Plugin/tests/data/testExtensions/';
     $GLOBALS['_MAX']['CONF']['pluginPaths']['admin'] = '/lib/OX/Plugin/tests/data/www/admin/plugins/';
     $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array('testGroup1' => 1, 'testGroup2' => 1);
     $aComponents[] = OX_Component::factoryByComponentIdentifier('testExtension1:testGroup1:testComponent1');
     $aComponents[] = OX_Component::factoryByComponentIdentifier('testExtension1:testGroup2:testComponent1');
     $aResult = OX_Component::callOnComponents($aComponents, 'staticMethod');
     $this->assertIsA($aResult, 'array');
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['0'], 'staticMethodResult1');
     $this->assertEqual($aResult['1'], 'staticMethodResult2');
     $aResult = OX_Component::callOnComponents($aComponents, 'staticMethodWithParams', array('foo'));
     $this->assertIsA($aResult, 'array');
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['0'], 'staticMethodWithParams1=foo');
     $this->assertEqual($aResult['1'], 'staticMethodWithParams2=foo');
 }
 $aElements += array('delivery_cacheExpire' => array('delivery' => 'cacheExpire'), 'delivery_cacheStorePlugin' => array('delivery' => 'cacheStorePlugin'));
 // Banner Delivery Settings
 $aElements += array('delivery_acls' => array('delivery' => 'acls', 'bool' => true), 'delivery_aclsDirectSelection' => array('delivery' => 'aclsDirectSelection', 'bool' => true), 'delivery_obfuscate' => array('delivery' => 'obfuscate', 'bool' => true), 'delivery_execPhp' => array('delivery' => 'execPhp', 'bool' => true), 'delivery_ctDelimiter' => array('delivery' => 'ctDelimiter'), 'defaultBanner_imageUrl' => array('defaultBanner' => 'imageUrl'));
 // Invocation Defaults
 $aElements += array('delivery_clicktracking' => array('delivery' => 'clicktracking'));
 // P3P Privacy Policies
 $aElements += array('p3p_policies' => array('p3p' => 'policies', 'bool' => true), 'p3p_compactPolicy' => array('p3p' => 'compactPolicy'), 'p3p_policyLocation' => array('p3p' => 'policyLocation'));
 // OpenX Server Access Paths
 $aElements += array('webpath_admin' => array('webpath' => 'admin', 'preg_match' => '#/$#', 'preg_replace' => ''), 'webpath_delivery' => array('webpath' => 'delivery', 'preg_match' => '#/$#', 'preg_replace' => ''), 'webpath_deliverySSL' => array('webpath' => 'deliverySSL', 'preg_match' => '#/$#', 'preg_replace' => ''), 'webpath_images' => array('webpath' => 'images', 'preg_match' => '#/$#', 'preg_replace' => ''), 'webpath_imagesSSL' => array('webpath' => 'imagesSSL', 'preg_match' => '#/$#', 'preg_replace' => ''));
 // Delivery File Names
 $aElements += array('file_click' => array('file' => 'click'), 'file_conversionvars' => array('file' => 'conversionvars'), 'file_content' => array('file' => 'content'), 'file_conversion' => array('file' => 'conversion'), 'file_conversionjs' => array('file' => 'conversionjs'), 'file_frame' => array('file' => 'frame'), 'file_image' => array('file' => 'image'), 'file_js' => array('file' => 'js'), 'file_layer' => array('file' => 'layer'), 'file_log' => array('file' => 'log'), 'file_popup' => array('file' => 'popup'), 'file_view' => array('file' => 'view'), 'file_xmlrpc' => array('file' => 'xmlrpc'), 'file_local' => array('file' => 'local'), 'file_frontcontroller' => array('file' => 'frontcontroller'), 'file_flash' => array('file' => 'flash'), 'file_singlepagecall' => array('file' => 'singlepagecall'), 'file_spcjs' => array('file' => 'spcjs'));
 // Test the suitability of the cache store type, if required
 MAX_commonRegisterGlobalsArray(array('delivery_cacheStorePlugin'));
 if (isset($delivery_cacheStorePlugin)) {
     // Check for problems in selected delivery store plugin
     $oDeliveryCacheStore =& OX_Component::factoryByComponentIdentifier($delivery_cacheStorePlugin);
     $result = $oDeliveryCacheStore->getStatus();
     if ($result !== true) {
         $aErrormessage[1][] = $oTranslation->translate('ErrorInCacheStorePlugin', array($oDeliveryCacheStore->getName()));
         foreach ($result as $error) {
             $aErrormessage[1][] = " - " . $error;
         }
     }
 }
 if (empty($aErrormessage)) {
     // Create a new settings object, and save the settings!
     $oSettings = new OA_Admin_Settings();
     $result = $oSettings->processSettingsFromForm($aElements);
     if ($result) {
         // Queue confirmation message
         $setPref = $oOptions->getSettingsPreferences($prefSection);
Ejemplo n.º 24
0
 function generateTags($zoneId, $codeType, $aParams = null)
 {
     // Backwards Compatibity Array for code types
     $aBackwardsCompatibityTypes = array('adframe' => 'invocationTags:oxInvocationTags:adframe', 'adjs' => 'invocationTags:oxInvocationTags:adjs', 'adlayer' => 'invocationTags:oxInvocationTags:adlayer', 'adview' => 'invocationTags:oxInvocationTags:adview', 'adviewnocookies' => 'invocationTags:oxInvocationTags:adviewnocookies', 'local' => 'invocationTags:oxInvocationTags:local', 'popup' => 'invocationTags:oxInvocationTags:popup', 'xmlrpc' => 'invocationTags:oxInvocationTags:xmlrpc');
     // Translate old code type to new Component Identifier
     if (array_key_exists($codeType, $aBackwardsCompatibityTypes)) {
         $codeType = $aBackwardsCompatibityTypes[$codeType];
     }
     if ($this->checkIdExistence('zones', $zoneId)) {
         $doZones = OA_Dal::staticGetDO('zones', $zoneId);
         if (!$this->checkPermissions(null, 'affiliates', $doZones->affiliateid, OA_PERM_ZONE_INVOCATION)) {
             return false;
         }
         $aAllowedTags = $this->getAllowedTags();
         if (!in_array($codeType, $aAllowedTags)) {
             $this->raiseError('Field \'codeType\' must be one of the enum: ' . join(', ', $aAllowedTags));
             return false;
         }
         if (!empty($codeType)) {
             require_once MAX_PATH . '/lib/max/Admin/Invocation.php';
             $maxInvocation = new MAX_Admin_Invocation();
             // factory plugin for this $codetype
             OA::disableErrorHandling();
             $invocationTag = OX_Component::factoryByComponentIdentifier($codeType);
             OA::enableErrorHandling();
             if ($invocationTag === false) {
                 $this->raiseError('Error while factory invocationTag plugin');
                 return false;
             }
             $invocationTag->setInvocation($maxInvocation);
             $aParams['zoneid'] = $zoneId;
             $aParams['codetype'] = $codeType;
             $buffer = $maxInvocation->generateInvocationCode($invocationTag, $aParams);
             return $buffer;
         } else {
             $this->raiseError('Parameter codeType wrong');
         }
     }
     return false;
 }
Ejemplo n.º 25
0
 /**
  * Place invocation form - generate form with group of options for every plugin,
  * look into max/docs/developer/plugins.zuml for more details
  *
  * @param array $extra
  * @param boolean $zone_invocation
  * @param array  $aParams          Input parameters, if null globals will be fetched
  *
  * @return string  Generated invocation form
  */
 function placeInvocationForm($extra = '', $zone_invocation = false, $aParams = null)
 {
     global $phpAds_TextDirection, $strWarningLocalInvocation, $strIABNoteLocalInvocation, $strIABNoteXMLRPCInvocation;
     $conf = $GLOBALS['_MAX']['CONF'];
     $pref = $GLOBALS['_MAX']['PREF'];
     $buffer = '';
     $this->zone_invocation = $zone_invocation;
     // register all the variables
     $this->assignVariables($aParams);
     if (is_array($extra)) {
         $this->assignVariables($extra);
     }
     // Deal with special variables
     $codetype = $this->codetype;
     $submitbutton = $this->submitbutton;
     // Check if affiliate is on the same server as the delivery code
     if (!empty($extra['website'])) {
         $server_max = parse_url('http://' . $conf['webpath']['delivery'] . '/');
         $server_affilate = parse_url($extra['website']);
         // this code could be extremely slow if host is unresolved
         $server_same = @gethostbyname($server_max['host']) == @gethostbyname($server_affilate['host']);
     } else {
         $server_same = true;
     }
     // Hide when integrated in zone-advanced.php
     if (!is_array($extra) || !isset($extra['zoneadvanced']) || !$extra['zoneadvanced']) {
         $buffer .= "<form id='generate' name='generate' action='" . $_SERVER['PHP_SELF'] . "' method='POST' onSubmit='return max_formValidate(this) && disableTextarea();'>\n";
     }
     // Invocation type selection
     if (!is_array($extra) || isset($extra['delivery']) && $extra['delivery'] != phpAds_ZoneInterstitial && $extra['delivery'] != phpAds_ZonePopup && $extra['delivery'] != MAX_ZoneEmail) {
         $invocationTags =& OX_Component::getComponents('invocationTags');
         $allowed = array();
         foreach ($invocationTags as $pluginKey => $invocationTag) {
             if ($invocationTag->isAllowed($extra, $server_same)) {
                 $aOrderedComponents[$invocationTag->getOrder()] = array('pluginKey' => $pluginKey, 'isAllowed' => $invocationTag->isAllowed($extra, $server_same), 'name' => $invocationTag->getName());
             }
         }
         ksort($aOrderedComponents);
         foreach ($aOrderedComponents as $order => $aComponent) {
             $allowed[$aComponent['pluginKey']] = $aComponent['isAllowed'];
         }
         if (!isset($codetype) || $allowed[$codetype] == false) {
             foreach ($allowed as $codetype => $isAllowed) {
                 break;
             }
         }
         if (!isset($codetype)) {
             $codetype = '';
         }
         if (!isset($bannerUrl)) {
             $bannerUrl = 'http://www.example.com/INSERT_BANNER_URL.gif';
         }
         $buffer .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
         $buffer .= "<tr><td height='25' width='350'><b>" . $GLOBALS['strChooseTypeOfBannerInvocation'] . "</b>";
         if ($codetype == "invocationTags:oxInvocationTags:adview" || $codetype == "invocationTags:oxInvocationTags:clickonly") {
             $buffer .= "";
         }
         $buffer .= "</td></tr><tr><td height='35' valign='top'>";
         $buffer .= "<select name='codetype' onChange=\"disableTextarea();this.form.submit()\" accesskey=" . $GLOBALS['keyList'] . " tabindex='" . $tabindex++ . "'>";
         $invocationTagsNames = array();
         foreach ($aOrderedComponents as $order => $aComponent) {
             $invocationTagsNames[$aComponent['pluginKey']] = $aComponent['name'];
         }
         foreach ($invocationTagsNames as $pluginKey => $invocationTagName) {
             $buffer .= "<option value='" . $pluginKey . "'" . ($codetype == $pluginKey ? ' selected' : '') . ">" . $invocationTagName . "</option>";
         }
         $buffer .= "</select>";
         $buffer .= "&nbsp;<input type='image' src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/go_blue.gif' border='0'></td>";
     } else {
         $invocationTags =& OX_Component::getComponents('invocationTags');
         foreach ($invocationTags as $invocationCode => $invocationTag) {
             if (isset($invocationTag->defaultZone) && $extra['delivery'] == $invocationTag->defaultZone) {
                 $codetype = $invocationCode;
                 break;
             }
         }
         if (!isset($codetype)) {
             $codetype = '';
         }
     }
     if ($codetype != '') {
         // factory plugin for this $codetype
         $invocationTag = OX_Component::factoryByComponentIdentifier($codetype);
         if ($invocationTag === false) {
             OA::debug('Error while factory invocationTag plugin');
             exit;
         }
         $invocationTag->setInvocation($this);
         $buffer .= $invocationTag->generateBannerSelection();
         $buffer .= phpAds_ShowBreak($print = false);
         $buffer .= "<br />";
         // Code
         // Layer and popup invocation types require specific paramters to be provided before invcation is possible
         if (empty($submitbutton) && ($codetype == 'invocationTags:oxInvocationTags:popup' || $codetype == 'invocationTags:oxInvocationTags:adlayer')) {
             $generated = false;
         } else {
             $buffer .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
             $buffer .= "<tr><td height='25'>";
             if ($codetype == 'invocationTags:oxInvocationTags:xmlrpc') {
                 $buffer .= "\n                        <div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>\n                            {$strIABNoteXMLRPCInvocation}\n                        </div>";
             }
             if ($codetype == "invocationTags:oxInvocationTags:clickonly" && !$this->zone_invocation) {
                 if ($bannerid == 0) {
                     $this->ads = array();
                 } else {
                     $this->ads = array($bannerid => $aAd);
                 }
             } elseif ($codetype == 'invocationTags:oxInvocationTags:local' && !$server_same) {
                 $buffer .= "\n                        <div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>\n                            {$strWarningLocalInvocation}\n                            <br><p>{$strIABNoteLocalInvocation}</p>\n                        </div>";
             } else {
                 if ($codetype == 'invocationTags:oxInvocationTags:local' && $server_same) {
                     $buffer .= "\n                        <div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>\n                            {$strIABNoteLocalInvocation}\n                        </div>";
                 }
             }
             // Supress the textarea if required by this plugin
             if (empty($invocationTag->suppressTextarea)) {
                 $buffer .= "<img src='" . OX::assetPath() . "/images/icon-generatecode.gif' align='absmiddle'>&nbsp;<b>" . $GLOBALS['strBannercode'] . "</b></td>";
                 // Show clipboard button only on IE
                 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') > 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') < 1) {
                     $buffer .= "<td height='25' align='right'><img src='" . OX::assetPath() . "/images/icon-clipboard.gif' align='absmiddle'>&nbsp;";
                     $buffer .= "<a href='javascript:max_CopyClipboard(\"bannercode\");'>" . $GLOBALS['strCopyToClipboard'] . "</a></td></tr>";
                 } else {
                     $buffer .= "<td>&nbsp;</td>";
                 }
                 $buffer .= "<tr height='1'><td colspan='2' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
                 $buffer .= "<tr><td colspan='2'>";
                 $buffer .= "<textarea id='bannercode' name='bannercode' class='code-gray' rows='15' cols='80' style='width:95%; border: 1px solid black' readonly>";
                 $buffer .= htmlspecialchars($this->generateInvocationCode($invocationTag));
                 $buffer .= "</textarea>";
                 $buffer .= "\n                        <script type='text/javascript'>\n                        <!--\n                        \$(document).ready(function() {\n                            \$('#bannercode').selectText();\n                        });\n                        //-->\n                        </script>";
             } else {
                 $buffer .= $this->generateInvocationCode($invocationTag);
             }
             $buffer .= "</td></tr>";
             $buffer .= "</table><br />";
             $buffer .= phpAds_ShowBreak($print = false);
             $buffer .= "<br />";
             $generated = true;
         }
         // Hide when integrated in zone-advanced.php
         if (!(is_array($extra) && isset($extra['zoneadvanced']) && $extra['zoneadvanced'])) {
             // Header
             // Parameters Section
             $buffer .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
             $buffer .= "<tr><td height='25' colspan='3'><img src='" . OX::assetPath() . "/images/icon-overview.gif' align='absmiddle'>&nbsp;<b>" . $GLOBALS['strParameters'] . "</b></td></tr>";
             $buffer .= "<tr height='1'><td width='30'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='30'></td>";
             $buffer .= "<td width='200'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='200'></td>";
             $buffer .= "<td width='100%'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
         }
         $buffer .= $invocationTag->generateOptions($this);
         // Hide when integrated in zone-advanced.php
         if (!(is_array($extra) && isset($extra['zoneadvanced']) && $extra['zoneadvanced'])) {
             // Footer
             $buffer .= "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
             $buffer .= "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
             $buffer .= "</table>";
             $buffer .= "<br /><br />";
             $buffer .= "<input type='hidden' value='" . ($generated ? 1 : 0) . "' name='generate'>";
             if ($generated) {
                 $buffer .= "<input type='submit' value='" . $GLOBALS['strRefresh'] . "' name='submitbutton' tabindex='" . $tabindex++ . "'>";
             } else {
                 $buffer .= "<input type='submit' value='" . $GLOBALS['strGenerate'] . "' name='submitbutton' tabindex='" . $tabindex++ . "'>";
             }
         }
     }
     // Put extra hidden fields
     if (is_array($extra)) {
         reset($extra);
         while (list($k, $v) = each($extra)) {
             $buffer .= "<input type='hidden' value='" . htmlspecialchars($v, ENT_QUOTES) . "' name='{$k}'>";
         }
     }
     // Hide when integrated in zone-advanced.php
     if (!is_array($extra) || !isset($extra['zoneadvanced']) || !$extra['zoneadvanced']) {
         $buffer .= "</form><br /><br />";
     }
     // Disable bannercode before submitting the form (causes problems with mod_security)
     $buffer .= "<script type='text/javascript'>\n            function disableTextarea() {\n                var form = findObj('generate');\n                if (typeof(form.bannercode) != 'undefined') {\n                    form.bannercode.disabled = true;\n                }\n                form.submit();\n            }\n            </script>\n        ";
     return $buffer;
 }
Ejemplo n.º 26
0
function phpAds_getBannerCache($banner)
{
    $aConf = $GLOBALS['_MAX']['CONF'];
    $aPref = $GLOBALS['_MAX']['PREF'];
    $buffer = $banner['htmltemplate'];
    // Strip slashes from urls
    $banner['url'] = stripslashes($banner['url']);
    $banner['imageurl'] = stripslashes($banner['imageurl']);
    // The following properties depend on data from the invocation process
    // and can't yet be determined: {zoneid}, {bannerid}
    // These properties will be set during invocation
    if ($banner['adserver'] == 'none') {
        $buffer = php_Ads_wrapBannerHtmlInClickUrl($banner, $buffer);
        return $buffer;
    }
    if ($banner['storagetype'] != 'html') {
        return $buffer;
    }
    // Auto change HTML banner
    if ($buffer != '') {
        // Put our click URL and our target parameter in all anchors...
        // The regexp should handle ", ', \", \' as delimiters
        if (preg_match_all('#<a(\\s[^>]*?)href\\s*=\\s*(\\\\?[\'"])http(.*?)\\2(.*?) *>#is', $buffer, $m)) {
            foreach ($m[0] as $k => $v) {
                // Remove target parameters
                $m[1][$k] = ' ' . trim(preg_replace('#target\\s*=\\s*(\\\\?[\'"]).*?\\1#i', '', $m[1][$k]));
                $m[4][$k] = ' ' . trim(preg_replace('#target\\s*=\\s*(\\\\?[\'"]).*?\\1#i', '', $m[4][$k]));
                $m[3][$k] = html_entity_decode($m[3][$k], null, 'UTF-8');
                $urlDest = preg_replace('/%7B(.*?)%7D/', '{$1}', urlencode("http" . $m[3][$k]));
                $buffer = str_replace($v, "<a{$m[1][$k]}href={$m[2][$k]}{clickurl}{$urlDest}{$m[2][$k]}{$m[4][$k]}target={$m[2][$k]}{target}{$m[2][$k]}>", $buffer);
            }
        }
        // Search: <\s*form (.*?)action\s*=\s*['"](.*?)['"](.*?)>
        // Replace:<form\1 action="{url_prefix}/{$aConf['file']['click']}" \3><input type='hidden' name='{clickurlparams}\2'>
        $target = !empty($banner['target']) ? $banner['target'] : "_self";
        // strip out the method from any <forms> these will be changed to GET
        $buffer = preg_replace('#<\\s*form (.*?)method\\s*=\\s*[\\\\]?[\'"](.*?)[\'"]#is', "<form \$1 method='GET'", $buffer);
        if (preg_match_all('#<\\s*form (.*?)action\\s*=\\s*[\\\\]?[\'"](.*?)[\'\\\\"][\'\\\\"]?(.*?)>(.*?)</form>#is', $buffer, $m)) {
            foreach ($m[0] as $k => $v) {
                // Remove target parameters
                $m[3][$k] = trim(preg_replace('#target\\s*=\\s*(\\\\?[\'"]).*?\\1#i', '', $m[3][$k]));
                $buffer = str_replace($v, "<form {$m[1][$k]} action='{url_prefix}/{$aConf['file']['click']}' {$m[3][$k]} target='{$target}'>{$m[4][$k]}<input type='hidden' name='{$aConf['var']['params']}' value='{clickurlparams}{$m[2][$k]}'></form>", $buffer);
            }
        }
        //$buffer = preg_replace("#<form*action='*'*>#i","<form target='{target}' $1action='{url_prefix}/{}$aConf['file']['click']'$3><input type='hidden' name='{clickurlparams}$2'>", $buffer);
        //$buffer = preg_replace("#<form*action=\"*\"*>#i","<form target=\"{target}\" $1action=\"{url_prefix}/{$aConf['file']['click']}\"$3><input type=\"hidden\" name=\"{clickurlparams}$2\">", $buffer);
        // In addition, we need to add our clickURL to the clickTAG parameter if present, for 3rd party flash ads
        // the clickTag is case insentive match, as it is correct to use clicktag, CLICKTAG, etc.
        preg_match('/^(.*)(clickTAG)\\s?=\\s?(.*?)([\'"])(.*)$/is', $buffer, $matches);
        if (count($matches) > 0) {
            $matches[3] = html_entity_decode($matches[3], null, 'UTF-8');
            $buffer = $matches[1] . $matches[2] . "={clickurl}" . urlencode($matches[3]) . $matches[4] . $matches[5];
        }
        // Detect any JavaScript window.open() functions, and prepend the opened URL with our logurl
        $buffer = preg_replace('#window.open\\s?\\((.*?)\\)#i', "window.open(\\\\'{logurl}&maxdest=\\\\'+\$1)", $buffer);
    }
    // Since we don't want to replace adserver noscript and iframe content with click tracking etc
    $noScript = array();
    //Capture noscript content into $noScript[0], for seperate translations
    preg_match("#<noscript>(.*?)</noscript>#is", $buffer, $noScript);
    $buffer = preg_replace("#<noscript>(.*?)</noscript>#is", '{noscript}', $buffer);
    // run 3rd party component
    if (!empty($banner['adserver'])) {
        require_once LIB_PATH . '/Plugin/Component.php';
        /**
         * @todo This entire function should be relocated to the DLL and should be object-ified
         *
         */
        PEAR::pushErrorHandling(null);
        $adServerComponent = OX_Component::factoryByComponentIdentifier($banner['adserver']);
        PEAR::popErrorHandling();
        if ($adServerComponent) {
            $buffer = $adServerComponent->getBannerCache($buffer, $noScript);
        } else {
            $GLOBALS['_MAX']['bannerrebuild']['errors'] = true;
        }
    }
    $buffer = php_Ads_wrapBannerHtmlInClickUrl($banner, $buffer);
    // Adserver processing complete, now replace the noscript values back:
    //$buffer = preg_replace("#{noframe}#", $noFrame[2], $buffer);
    if (isset($noScript[0])) {
        $buffer = preg_replace("#{noscript}#", $noScript[0], $buffer);
    }
    // Allow custom banner types to alter the banner cache.
    $bannerTypeComponent = OX_Component::factoryByComponentIdentifier($banner['ext_bannertype']);
    if ($bannerTypeComponent) {
        $buffer = $bannerTypeComponent->getBannerCache($buffer, $noScript, $banner);
    }
    return $buffer;
}
Ejemplo n.º 27
0
    $aBanner['keyword'] = '';
    $aBanner["weight"] = $pref['default_banner_weight'];
    $aBanner['iframe_friendly'] = true;
    $aBanner['hardcoded_links'] = array();
    $aBanner['hardcoded_targets'] = array();
}
if ($ext_bannertype) {
    $oComponent = OX_Component::factoryByComponentIdentifier($ext_bannertype);
    //  we may want to use the ancestor class for some sort of generic functionality
    if (!$oComponent) {
        $oComponent = OX_Component::getFallbackHandler($extension);
    }
    $formDisabled = !$oComponent || !$oComponent->enabled;
}
if (!$ext_bannertype && $type && !in_array($type, array('sql', 'web', 'url', 'html', 'txt'))) {
    $oComponent = OX_Component::factoryByComponentIdentifier($type);
    $formDisabled = !$oComponent || !$oComponent->enabled;
    if ($oComponent) {
        $ext_bannertype = $type;
        $type = $oComponent->getStorageType();
    } else {
        $ext_bannertype = '';
        $type = '';
    }
}
// If adding a new banner or used storing type is disabled
// determine which bannertype to show as default
$show_sql = $conf['allowedBanners']['sql'];
$show_web = $conf['allowedBanners']['web'];
$show_url = $conf['allowedBanners']['url'];
$show_html = $conf['allowedBanners']['html'];