/** * A factory method to return the appropriate * OA_Maintenance_Priority_DeliveryLimitation_Common * subclass object (one of OA_Maintenance_Priority_DeliveryLimitation_Date, * OA_Maintenance_Priority_DeliveryLimitation_Day, * OA_Maintenance_Priority_DeliveryLimitation_Empty or * OA_Maintenance_Priority_DeliveryLimitation_Hour), depending on the data * provided. * * @static * @param array $aDeliveryLimitation An array containing the details of a delivery limitation * associated with an ad. For example: * array( * [ad_id] => 1 * [logical] => and * [type] => Time:Hour * [comparison] => == * [data] => 1,7,18,23 * [executionorder] => 1 * ) * @return object OA_Maintenance_Priority_DeliveryLimitation_Common */ function &factory($aDeliveryLimitation) { // Load plugins if not already in cache if (!isset(self::$aPlugins)) { self::$aPlugins = OX_Component::getComponents('deliveryLimitations', null, false); } // Return instance of the MPE DL class if (isset(self::$aPlugins[$aDeliveryLimitation['type']])) { return self::$aPlugins[$aDeliveryLimitation['type']]->getMpeClassInstance($aDeliveryLimitation); } // Unknown plugin? Return the empty MPE DL class return new OA_Maintenance_Priority_DeliveryLimitation_Empty($aDeliveryLimitation); }
/** * A private method to find all report plugins with can be executed * by the current user. * * @access private * @return array An array of all the plugins that the user has * access to excute, indexed by the plugin type. */ function _findDisplayableReports() { $aDisplayablePlugins = array(); // Get all the report plugins. $aPlugins = OX_Component::getComponents('reports'); // Check the user's authorization level foreach ($aPlugins as $pluginType => $oPlugin) { if (!$oPlugin->isAllowedToExecute()) { continue; } $aDisplayablePlugins[$pluginType] = $oPlugin; } return $aDisplayablePlugins; }
/** * A method to run distributed maintenance. */ function run() { if (empty($GLOBALS['_MAX']['CONF']['lb']['enabled'])) { OA::debug('Distributed stats disabled, not running Maintenance Distributed Engine', PEAR_LOG_INFO); return; } if (!empty($GLOBALS['_MAX']['CONF']['rawDatabase'])) { $GLOBALS['_MAX']['CONF']['database'] = $GLOBALS['_MAX']['CONF']['rawDatabase'] + $GLOBALS['_MAX']['CONF']['database']; OA::debug('rawDatabase functionality is being used, switching settings', PEAR_LOG_INFO); } $oLock =& OA_DB_AdvisoryLock::factory(); if (!$oLock->get(OA_DB_ADVISORYLOCK_DISTRIBUTED)) { OA::debug('Maintenance Distributed Engine Already Running', PEAR_LOG_INFO); return; } OA::debug('Running Maintenance Distributed Engine', PEAR_LOG_INFO); // Attempt to increase PHP memory OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance')); // Ensure the current time is registered with the OA_ServiceLocator $oServiceLocator =& OA_ServiceLocator::instance(); $oNow =& $oServiceLocator->get('now'); if (!$oNow) { // Record the current time, and register with the OA_ServiceLocator $oNow = new Date(); $oServiceLocator->register('now', $oNow); } OA::debug(' - Current time is ' . $oNow->format('%Y-%m-%d %H:%M:%S') . ' ' . $oNow->tz->getShortName(), PEAR_LOG_DEBUG); // Get the components of the deliveryLog extension $aBuckets = OX_Component::getComponents('deliveryLog'); // Copy buckets' records with "interval_start" up to and including previous OI start, // and then prune the data processed $aPreviousOperationIntervalDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oNow); OA::debug(' - Will process data for all operation intervals before and up to start', PEAR_LOG_DEBUG); OA::debug(' time of ' . $aPreviousOperationIntervalDates['start']->format('%Y-%m-%d %H:%M:%S') . ' ' . $aPreviousOperationIntervalDates['start']->tz->getShortName(), PEAR_LOG_DEBUG); foreach ($aBuckets as $sBucketName => $oBucketClass) { if ($oBucketClass->testStatisticsMigration($oBucketClass->getStatisticsMigration())) { $oBucketClass->processBucket($aPreviousOperationIntervalDates['start']); $oBucketClass->pruneBucket($aPreviousOperationIntervalDates['start']); } else { OA::debug(' - Skipping ' . $sBucketName, PEAR_LOG_DEBUG); } } $oLock->release(); OA::debug('Maintenance Distributed Engine Completed', PEAR_LOG_INFO); }
/** * Append type-specific form elements to the base form * * @param object &$form * @param array &$row */ function buildForm(&$form, &$row) { $form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)"); $header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner'] . " - banner code"); $header->setAttribute('icon', 'icon-banner-html.gif'); $form->addElement($header); $adPlugins = OX_Component::getComponents('3rdPartyServers'); $adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName'); $adPluginsList = array(); $adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric']; $adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml']; foreach ($adPluginsNames as $adPluginKey => $adPluginName) { $adPluginsList[$adPluginKey] = $adPluginName; } $htmlG['textarea'] = $form->createElement('textarea', 'htmltemplate', null, array('class' => 'code', 'cols' => '45', 'rows' => '10', 'wrap' => 'off', 'dir' => 'ltr', 'style' => 'width:550px;')); $aSelectAttributes = array('id' => 'adserver', 'style' => 'margin-left: 15px;width:230px'); $htmlG['select'] = HTML_QuickForm::createElement('select', 'adserver', $GLOBALS['strAlterHTML'], $adPluginsList, $aSelectAttributes); $form->addGroup($htmlG, 'html_banner_g', null, array("<br>", ""), false); $form->addElement('advcheckbox', 'iframe_friendly', $GLOBALS['strIframeFriendly']); if ($row['bannerid'] && ($row['url'] || $row['target'])) { // The "url" and "target" elements remain as part of the form definition // for HTML banners only for existing banners that have either // url or target already set. $form->addElement('header', 'header_b_links', "Banner link"); $form->addElement('text', 'url', $GLOBALS['strURL']); $form->addElement('text', 'target', $GLOBALS['strTarget']); } $form->addElement('header', 'header_b_display', 'Banner display'); $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":"); $sizeG['width']->setSize(5); $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":"); $sizeG['height']->setSize(5); if (!empty($row['bannerid'])) { $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); } $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false); $form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier()); //validation rules $translation = new OX_Translation(); $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required'); $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required'); $numericRule = array($GLOBALS['strNumericField'], 'numeric'); $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule), 'height' => array($heightRequiredRule, $numericRule))); }
function buildForm(&$form, &$row) { $form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)"); $header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner']); $header->setAttribute('icon', 'icon-banner-html.gif'); $form->addElement($header); $adPlugins = OX_Component::getComponents('3rdPartyServers'); $adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName'); $adPluginsList = array(); $adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric']; $adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml']; foreach ($adPluginsNames as $adPluginKey => $adPluginName) { $adPluginsList[$adPluginKey] = $adPluginName; } $form->addElement('select', 'adserver', $this->translate($GLOBALS['strAlterHTML']), $adPluginsList, $aSelectAttributes); $form->addElement('header', 'header_b_parameters', $this->translate("Banner display")); $form->addElement('text', 'p_link_url', $this->translate($GLOBALS['strURL'])); $form->addElement('text', 'p_link_text', $this->translate("Link text")); $form->addElement('text', 'p_title', $this->translate("Title")); $form->addElement('text', 'p_description', $this->translate("Description")); $form->addElement('text', 'p_image_url', $this->translate("Url Image")); $form->addElement('text', 'p_click_url_unesc', $this->translate("Click url Unesc")); $form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier()); $bannerId = $row['bannerid']; if ($bannerId) { $doBanners = OA_Dal::factoryDO('my_banners'); $doBanners->bannerid = $bannerId; $doBanners->find(true); $row['terra_link_url'] = $doBanners->terra_link_url; $row['terra_link_text'] = $doBanners->terra_link_text; $row['terra_title'] = $doBanners->terra_title; $row['terra_description'] = $doBanners->terra_description; $row['terra_image_url'] = $doBanners->terra_image_url; $row['terra_click_url_unesc'] = $doBanners->terra_click_url_unesc; $form->setDefaults(array('p_link_url' => $doBanners->terra_link_url, 'p_link_text' => $doBanners->terra_link_text, 'p_title' => $doBanners->terra_title, 'p_description' => $doBanners->terra_description, 'p_image_url' => $doBanners->terra_image_url, 'p_click_url_unesc' => $doBanners->terra_click_url_unesc)); } }
function insert() { // $this->setEcpmEnabled(); if ($this->priority == self::PRIORITY_ECPM || $this->ecpm_enabled) { $this->ecpm = $this->calculateEcpm(); } // Set the correct campaign status $this->setStatus(); $id = parent::insert(); if (!$id) { return $id; } // Initalise any tracker based plugins $plugins = array(); require_once LIB_PATH . '/Plugin/Component.php'; $invocationPlugins =& OX_Component::getComponents('invocationTags'); foreach ($invocationPlugins as $pluginKey => $plugin) { if (!empty($plugin->trackerEvent)) { $plugins[] = $plugin; } } // Link automatically any trackers which are marked as "link with any new campaigns" $doTrackers = $this->factory('trackers'); $doTrackers->clientid = $this->clientid; $doTrackers->linkcampaigns = 't'; $doTrackers->find(); while ($doTrackers->fetch()) { $doCampaigns_trackers = $this->factory('campaigns_trackers'); $doCampaigns_trackers->init(); $doCampaigns_trackers->trackerid = $doTrackers->trackerid; $doCampaigns_trackers->campaignid = $this->campaignid; $doCampaigns_trackers->clickwindow = $doTrackers->clickwindow; $doCampaigns_trackers->viewwindow = $doTrackers->viewwindow; $doCampaigns_trackers->status = $doTrackers->status; foreach ($plugins as $oPlugin) { $fieldName = strtolower($oPlugin->trackerEvent); $doCampaigns_trackers->{$fieldName} = $doTrackers->{$fieldName}; } $doCampaigns_trackers->insert(); } return $id; }
/** * 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 " <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'> <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'> </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>"; }
function MAX_displayAcls($acls, $aParams) { $tabindex =& $GLOBALS['tabindex']; $page = basename($_SERVER['SCRIPT_NAME']); $conf = $GLOBALS['_MAX']['CONF']; echo "<form action='{$page}' method='post'>"; echo "<label><img src='" . OX::assetPath() . "/images/icon-acl-add.gif' align='absmiddle'> " . $GLOBALS['strACLAdd'] . ": "; echo "<select name='type' accesskey='{$GLOBALS['keyAddNew']}' tabindex='" . $tabindex++ . "'>"; $deliveryLimitations = OX_Component::getComponents('deliveryLimitations', null, false); foreach ($deliveryLimitations as $pluginName => $plugin) { if ($plugin->isAllowed($page)) { echo "<option value='{$pluginName}'>" . $plugin->getName() . "</option>"; } } echo "</select></label>"; echo " "; echo "<input type='submit' class='flat' name='action[new]' value='" . $GLOBALS['strAdd'] . "'"; phpAds_ShowBreak(); echo "<br />"; $aErrors = OX_AclCheckInputsFields($acls, $page); if (!empty($GLOBALS['action'])) { // We are part way through making changes, show a message //echo "<br>"; echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>"; echo "<span class='tab-s'>{$GLOBALS['strUnsavedChanges']}</span><br>"; echo "</div>"; } elseif (!MAX_AclValidate($page, $aParams)) { echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>"; echo "<span class='tab-r'>{$GLOBALS['strDeliveryLimitationsDisagree']}</span><br>"; echo "</div>"; } if ($aErrors !== true) { echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>"; echo "<span class='tab-s'>{$GLOBALS['strDeliveryLimitationsInputErrors']}</span><br><ul>"; foreach ($aErrors as $error) { echo "<li><span class='tab-s'>{$error}</span><br></li>"; } echo "</ul></div>"; } foreach ($aParams as $name => $value) { echo "<input type='hidden' name='{$name}' value='{$value}' />"; } echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><td height='25' colspan='4' bgcolor='#FFFFFF'><b>{$GLOBALS['strDeliveryLimitations']}</b></td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; if (empty($acls)) { echo "<tr><td height='24' colspan='4' bgcolor='#F6F6F6'> {$GLOBALS['strNoLimitations']}</td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; } else { echo "<tr><td height='25' colspan='4' bgcolor='#F6F6F6'> {$GLOBALS['strOnlyDisplayWhen']}</td></tr>"; echo "<tr><td colspan='4'><img src='" . OX::assetPath() . "/images/break-el.gif' width='100%' height='1'></td></tr>"; foreach ($acls as $aclId => $acl) { if ($deliveryLimitationPlugin = OA_aclGetComponentFromRow($acl)) { $deliveryLimitationPlugin->init($acl); $deliveryLimitationPlugin->count = count($acls); if ($deliveryLimitationPlugin->isAllowed($page)) { $deliveryLimitationPlugin->display(); } } } } echo "<tr><td height='30' colspan='2'>"; if (!empty($acls)) { $url = $page . '?'; foreach ($aParams as $name => $value) { $url .= "{$name}={$value}&"; } $url .= "action[clear]=true"; echo "<img src='" . OX::assetPath() . "/images/icon-recycle.gif' border='0' align='absmiddle'> \n <a href='{$url}'>{$GLOBALS['strRemoveAllLimitations']}</a> \n "; } echo "</td><td height='30' colspan='2' align='{$GLOBALS['phpAds_TextAlignRight']}'>"; echo "</td></tr>"; echo "</table>"; }
function testGetAllowedTags() { TestEnv::installPluginPackage('openXInvocationTags'); $dllZone = new OA_Dll_Zone(); $aZoneAllowedTags = $dllZone->getAllowedTags(); // Test if only and all allowed tags are returned $count = 0; $invocationTags =& OX_Component::getComponents('invocationTags'); foreach ($invocationTags as $pluginKey => $invocationTag) { if ($invocationTag->isAllowed(null, null)) { $count++; $this->assertTrue(in_array($pluginKey, $aZoneAllowedTags)); } else { $this->assertFalse(in_array($pluginKey, $aZoneAllowedTags)); } } $this->assertEqual($count, count($aZoneAllowedTags)); // tests if spc is disallowed anyway $GLOBALS['_MAX']['CONF']['spc']['allowed'] = true; $aZoneAllowedTags = $dllZone->getAllowedTags(); $this->assertFalse(in_array('spc', $aZoneAllowedTags)); unset($GLOBALS['_MAX']['CONF']['spc']['allowed']); TestEnv::uninstallPluginPackage('openXInvocationTags'); }
function buildAlgorithmFormSection($form, $aZone) { $aAlgorithmPlugins = OX_Component::getComponents('deliveryAdSelect'); if (!empty($aAlgorithmPlugins) && is_array($aAlgorithmPlugins)) { // Add the 'Default' (internal) algorithm to the list $aItems = array('none' => 'Default (internal)'); foreach ($aAlgorithmPlugins as $oAlgorithmPlugin) { // Only include components which implement the onDemand adselect hook function // This is not the cleanest way to do it :( but it works :) $aInfo = $oAlgorithmPlugin->parseComponentIdentifier($oAlgorithmPlugin->getComponentIdentifier()); if (function_exists('Plugin_' . implode('_', $aInfo) . '_Delivery' . '_adSelect')) { $aItems[$oAlgorithmPlugin->getComponentIdentifier()] = $oAlgorithmPlugin->getName(); } } // Only display the select box if at least one alternative algorithm is provided if (count($aItems) === 1) { $form->addElement('hidden', 'ext_adselection', 'none'); return; } $form->addElement('header', 'header_algorithm', 'Ad selection algorithm'); $form->addElement('select', 'ext_adselection', 'Plugin to use for ad selection in this zone', $aItems); } }
function test_getComponents() { $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, 'testPlugin' => 1); $aComponents = OX_Component::getComponents('testExtension1', 'testGroup1', true); $this->assertTrue(isset($aComponents['testExtension1:testGroup1:testComponent1'])); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->extension, 'testExtension1'); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->group, 'testGroup1'); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->component, 'testComponent1'); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->enabled, true); $this->assertTrue(isset($aComponents['testExtension1:testGroup1:testComponent2'])); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->extension, 'testExtension1'); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->group, 'testGroup1'); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->component, 'testComponent2'); $this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->enabled, true); $aComponents = OX_Component::getComponents('admin', 'testPlugin', false); $this->assertTrue(isset($aComponents['admin:testPlugin:testPlugin'])); $this->assertEqual($aComponents['admin:testPlugin:testPlugin']->extension, 'admin'); $this->assertEqual($aComponents['admin:testPlugin:testPlugin']->group, 'testPlugin'); $this->assertEqual($aComponents['admin:testPlugin:testPlugin']->component, 'testPlugin'); $this->assertEqual($aComponents['admin:testPlugin:testPlugin']->enabled, true); TestEnv::restoreConfig(); }
/** * Required for mocking OX_Component::getComponents * * @return array Array of components in chosen extension, group */ function _getComponents($extension, $group, $recursive = 1, $enabledOnly = false) { return OX_Component::getComponents($extension, $group, $recursive, $enabledOnly); }
require_once LIB_PATH . '/Plugin/Component.php'; // Register input variables phpAds_registerGlobal('action', 'trackerids', 'clickwindowday', 'clickwindowhour', 'clickwindowminute', 'clickwindows', 'clickwindowsecond', 'hideinactive', 'statusids', 'submit', 'viewwindowday', 'viewwindowhour', 'viewwindowminute', 'viewwindows', 'viewwindowsecond'); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER); OA_Permission::enforceAccessToObject('clients', $clientid); OA_Permission::enforceAccessToObject('campaigns', $campaignid); /*-------------------------------------------------------*/ /* Store preferences */ /*-------------------------------------------------------*/ $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid; $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid; phpAds_SessionDataStore(); // Initalise any tracker based plugins $plugins = array(); $invocationPlugins =& OX_Component::getComponents('invocationTags'); foreach ($invocationPlugins as $pluginKey => $plugin) { if (!empty($plugin->trackerEvent)) { $plugins[] = $plugin; $fieldName = strtolower($plugin->trackerEvent); phpAds_registerGlobal("{$fieldName}windowday", "{$fieldName}windowhour", "{$fieldName}windowminute", "{$fieldName}windowsecond", "{$fieldName}windows"); } } /*-------------------------------------------------------*/ /* Process submitted form */ /*-------------------------------------------------------*/ if (!empty($campaignid)) { if (isset($action) && $action == 'set') { $clickWindow = _windowValuesToseconds($clickwindowday, $clickwindowhour, $clickwindowminute, $clickwindowsecond); $viewWindow = _windowValuesToseconds($viewwindowday, $viewwindowhour, $viewwindowminute, $viewwindowsecond); $doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignid);
/** * Generate the HTML option for output adserver selection * * @return string A string containing html for option */ function thirdPartyServer() { $conf = $GLOBALS['_MAX']['CONF']; $pref = $GLOBALS['_MAX']['PREF']; $selectedOutputAdServer = is_null($this->maxInvocation->thirdpartytrack) ? $conf['delivery']['clicktracking'] : $this->maxInvocation->thirdpartytrack; $maxInvocation =& $this->maxInvocation; $option = ''; $option .= "\n <tr>\n <td width='30'> </td>\n <td width='200'>{$GLOBALS['str3rdPartyTrack']}</td>\n <td width='370'>\n "; // Add selection box for output adservers $option .= "<select name='thirdpartytrack' tabindex='" . $maxInvocation->tabindex++ . "'>"; $option .= "<option value='0'>{$GLOBALS['strNo']}</option>"; $option .= "<option value='generic' " . ($maxInvocation->thirdpartytrack == 'generic' ? " selected='selected'" : '') . ">{$GLOBALS['strGenericOutputAdServer']}</option>"; $outputAdServers =& OX_Component::getComponents('3rdPartyServers'); $availableOutputAdServerNames = array(); foreach ($outputAdServers as $pluginKey => $outputAdServer) { if (!empty($outputAdServer->hasOutputMacros)) { $availableOutputAdServers[$pluginKey] = $outputAdServer; $availableOutputAdServerNames[$pluginKey] = $outputAdServer->getName(); } } asort($availableOutputAdServerNames); foreach ($availableOutputAdServerNames as $pluginKey => $outputAdServerName) { $option .= "<option value='{$pluginKey}'" . ($maxInvocation->thirdpartytrack == $pluginKey ? ' selected="selected"' : '') . ">" . $outputAdServerName . "</option>"; } $option .= "</select>"; $option .= "</tr>"; $option .= "<tr><td width='30'><img src='" . OX::assetPath() . "/images/spacer.gif' height='5' width='100%'></td></tr>"; return $option; }
$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) { $aBannerTypeText = OX_Component::getComponents('bannerTypeText'); foreach ($aBannerTypeText as $tmpComponent) { $componentIdentifier = $tmpComponent->getComponentIdentifier(); $bannerTypes['text'][$componentIdentifier] = $tmpComponent->getOptionDescription(); } } if (!$type) { if ($show_txt) { $type = "txt"; } } $form = buildBannerForm($type, $aBanner, $oComponent, $formDisabled); $valid = $form->validate(); if ($valid && $oComponent && $oComponent->enabled) { $valid = $oComponent->validateForm($form); }
/** * 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 .= " <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; }
| (at your option) any later version. | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the Free Software | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | +---------------------------------------------------------------------------+ $Id: index.php 37157 2009-05-28 12:31:10Z andrew.hill $ */ /** * This file creates the dispatch map by merging core and plugin dispatch maps * and starts the XML-RPC server. */ require_once '../../../../init.php'; require_once LIB_PATH . '/Plugin/Component.php'; require_once 'XmlRpcFrontController.php'; $fc = new XmlrpcFrontController(); // OpenX Core Dispatch map $dispatches = array('ox.logon' => array('function' => array($fc, 'logon'), 'signature' => array(array('string', 'string', 'string')), 'docstring' => 'Logon method'), 'ox.logoff' => array('function' => array($fc, 'logoff'), 'signature' => array(array('bool', 'string')), 'docstring' => 'Logoff method'), 'ox.addAdvertiser' => array('function' => array($fc, 'addAdvertiser'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add advertiser'), 'ox.modifyAdvertiser' => array('function' => array($fc, 'modifyAdvertiser'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify advertiser information'), 'ox.deleteAdvertiser' => array('function' => array($fc, 'deleteAdvertiser'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete advertiser'), 'ox.advertiserDailyStatistics' => array('function' => array($fc, 'advertiserDailyStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Advertiser Daily Statistics'), 'ox.advertiserCampaignStatistics' => array('function' => array($fc, 'advertiserCampaignStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Advertiser Campaign Statistics'), 'ox.advertiserBannerStatistics' => array('function' => array($fc, 'advertiserBannerStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Advertiser Banner Statistics'), 'ox.advertiserPublisherStatistics' => array('function' => array($fc, 'advertiserPublisherStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Advertiser Publisher Statistics'), 'ox.advertiserZoneStatistics' => array('function' => array($fc, 'advertiserZoneStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Advertiser Zone Statistics'), 'ox.getAdvertiser' => array('function' => array($fc, 'getAdvertiser'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Advertiser Information'), 'ox.getAdvertiserListByAgencyId' => array('function' => array($fc, 'getAdvertiserListByAgencyId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Advertiser List By Agency Id'), 'ox.addAgency' => array('function' => array($fc, 'addAgency'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add agency'), 'ox.modifyAgency' => array('function' => array($fc, 'modifyAgency'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify agency information'), 'ox.deleteAgency' => array('function' => array($fc, 'deleteAgency'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete agency'), 'ox.agencyDailyStatistics' => array('function' => array($fc, 'agencyDailyStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Agency Daily Statistics'), 'ox.agencyAdvertiserStatistics' => array('function' => array($fc, 'agencyAdvertiserStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Agency Advertiser Statistics'), 'ox.agencyCampaignStatistics' => array('function' => array($fc, 'agencyCampaignStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Agency Campaign Statistics'), 'ox.agencyBannerStatistics' => array('function' => array($fc, 'agencyBannerStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Agency Banner Statistics'), 'ox.agencyPublisherStatistics' => array('function' => array($fc, 'agencyPublisherStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Agency Publisher Statistics'), 'ox.agencyZoneStatistics' => array('function' => array($fc, 'agencyZoneStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Agency Zone Statistics'), 'ox.getAgency' => array('function' => array($fc, 'getAgency'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Agency Information'), 'ox.getAgencyList' => array('function' => array($fc, 'getAgencyList'), 'signature' => array(array('array', 'string')), 'docstring' => 'Get Agency List'), 'ox.addBanner' => array('function' => array($fc, 'addBanner'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add banner'), 'ox.modifyBanner' => array('function' => array($fc, 'modifyBanner'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify banner information'), 'ox.deleteBanner' => array('function' => array($fc, 'deleteBanner'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete banner'), 'ox.getBannerTargeting' => array('function' => array($fc, 'getBannerTargeting'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get banner targeting limitations array'), 'ox.setBannerTargeting' => array('function' => array($fc, 'setBannerTargeting'), 'signature' => array(array('boolean', 'string', 'int', 'array')), 'docstring' => 'Set banner targeting limitations array'), 'ox.bannerDailyStatistics' => array('function' => array($fc, 'bannerDailyStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Banner Daily Statistics'), 'ox.bannerPublisherStatistics' => array('function' => array($fc, 'bannerPublisherStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Banner Publisher Statistics'), 'ox.bannerZoneStatistics' => array('function' => array($fc, 'bannerZoneStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Banner Zone Statistics'), 'ox.getBanner' => array('function' => array($fc, 'getBanner'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Banner Information'), 'ox.getBannerListByCampaignId' => array('function' => array($fc, 'getBannerListByCampaignId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Banner List By Campaign Id'), 'ox.addCampaign' => array('function' => array($fc, 'addCampaign'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add campaign'), 'ox.modifyCampaign' => array('function' => array($fc, 'modifyCampaign'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify campaign information'), 'ox.deleteCampaign' => array('function' => array($fc, 'deleteCampaign'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete campaign'), 'ox.campaignDailyStatistics' => array('function' => array($fc, 'campaignDailyStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate campaign Daily Statistics'), 'ox.campaignBannerStatistics' => array('function' => array($fc, 'campaignBannerStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate campaign Banner Statistics'), 'ox.campaignPublisherStatistics' => array('function' => array($fc, 'campaignPublisherStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate campaign Publisher Statistics'), 'ox.campaignZoneStatistics' => array('function' => array($fc, 'campaignZoneStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate campaign Zone Statistics'), 'ox.getCampaign' => array('function' => array($fc, 'getCampaign'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Campaign Information'), 'ox.getCampaignListByAdvertiserId' => array('function' => array($fc, 'getCampaignListByAdvertiserId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Campaign List By Advertiser Id'), 'ox.addChannel' => array('function' => array($fc, 'addChannel'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add Channel'), 'ox.modifyChannel' => array('function' => array($fc, 'modifyChannel'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify Channel Information'), 'ox.deleteChannel' => array('function' => array($fc, 'deleteChannel'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete Channel'), 'ox.getChannel' => array('function' => array($fc, 'getChannel'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Channel Information'), 'ox.getChannelListByWebsiteId' => array('function' => array($fc, 'getChannelListByWebsiteId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Website Channel List'), 'ox.getChannelListByAgencyId' => array('function' => array($fc, 'getChannelListByAgencyId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Agency Channel List'), 'ox.getChannelTargeting' => array('function' => array($fc, 'getChannelTargeting'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get channel targeting limitations array'), 'ox.setChannelTargeting' => array('function' => array($fc, 'setChannelTargeting'), 'signature' => array(array('boolean', 'string', 'int', 'array')), 'docstring' => 'Set channel targeting limitations array'), 'ox.addPublisher' => array('function' => array($fc, 'addPublisher'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add publisher'), 'ox.modifyPublisher' => array('function' => array($fc, 'modifyPublisher'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify publisher information'), 'ox.deletePublisher' => array('function' => array($fc, 'deletePublisher'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete publisher'), 'ox.publisherDailyStatistics' => array('function' => array($fc, 'publisherDailyStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Publisher Daily Statistics'), 'ox.publisherZoneStatistics' => array('function' => array($fc, 'publisherZoneStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Publisher Zone Statistics'), 'ox.publisherAdvertiserStatistics' => array('function' => array($fc, 'publisherAdvertiserStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Publisher Advertiser Statistics'), 'ox.publisherCampaignStatistics' => array('function' => array($fc, 'publisherCampaignStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Publisher Campaign Statistics'), 'ox.publisherBannerStatistics' => array('function' => array($fc, 'publisherBannerStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Publisher Banner Statistics'), 'ox.getPublisher' => array('function' => array($fc, 'getPublisher'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Publisher Information'), 'ox.getPublisherListByAgencyId' => array('function' => array($fc, 'getPublisherListByAgencyId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Publishers List By Agency Id'), 'ox.addUser' => array('function' => array($fc, 'addUser'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add user'), 'ox.modifyUser' => array('function' => array($fc, 'modifyUser'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify user information'), 'ox.deleteUser' => array('function' => array($fc, 'deleteUser'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete user'), 'ox.getUser' => array('function' => array($fc, 'getUser'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get User Information'), 'ox.getUserListByAccountId' => array('function' => array($fc, 'getUserListByAccountId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get User List By Account Id'), 'ox.updateSsoUserId' => array('function' => array($fc, 'updateSsoUserId'), 'signature' => array(array('array', 'string', 'int', 'int')), 'docstring' => 'Change the SSO User ID field'), 'ox.updateUserEmailBySsoId' => array('function' => array($fc, 'updateUserEmailBySsoId'), 'signature' => array(array('array', 'string', 'int', 'string')), 'docstring' => 'Change users email for the user who match the SSO User ID'), 'ox.addZone' => array('function' => array($fc, 'addZone'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Add zone'), 'ox.modifyZone' => array('function' => array($fc, 'modifyZone'), 'signature' => array(array('int', 'string', 'struct')), 'docstring' => 'Modify zone information'), 'ox.deleteZone' => array('function' => array($fc, 'deleteZone'), 'signature' => array(array('int', 'string', 'int')), 'docstring' => 'Delete zone'), 'ox.zoneDailyStatistics' => array('function' => array($fc, 'zoneDailyStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Zone Daily Statistics'), 'ox.zoneAdvertiserStatistics' => array('function' => array($fc, 'zoneAdvertiserStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Zone Advertiser Statistics'), 'ox.zoneCampaignStatistics' => array('function' => array($fc, 'zoneCampaignStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Zone Campaign Statistics'), 'ox.zoneBannerStatistics' => array('function' => array($fc, 'zoneBannerStatistics'), 'signature' => array(array('array', 'string', 'int', 'dateTime.iso8601', 'dateTime.iso8601'), array('array', 'string', 'int', 'dateTime.iso8601'), array('array', 'string', 'int')), 'docstring' => 'Generate Zone Banner Statistics'), 'ox.getZone' => array('function' => array($fc, 'getZone'), 'signature' => array(array('struct', 'string', 'int')), 'docstring' => 'Get Zone Information'), 'ox.getZoneListByPublisherId' => array('function' => array($fc, 'getZoneListByPublisherId'), 'signature' => array(array('array', 'string', 'int')), 'docstring' => 'Get Zone List By Publisher Id'), 'ox.linkBanner' => array('function' => array($fc, 'linkBanner'), 'signature' => array(array('int', 'string', 'int', 'int')), 'docstring' => 'Link a banner to a zone'), 'ox.linkCampaign' => array('function' => array($fc, 'linkCampaign'), 'signature' => array(array('int', 'string', 'int', 'int')), 'docstring' => 'Link a campaign to a zone'), 'ox.unlinkBanner' => array('function' => array($fc, 'unlinkBanner'), 'signature' => array(array('int', 'string', 'int', 'int')), 'docstring' => 'Unlink a banner to from zone'), 'ox.unlinkCampaign' => array('function' => array($fc, 'unlinkCampaign'), 'signature' => array(array('int', 'string', 'int', 'int')), 'docstring' => 'Unlink a campaign from a zone'), 'ox.generateTags' => array('function' => array($fc, 'generateTags'), 'signature' => array(array('string', 'string', 'int', 'string', 'struct'), array('string', 'string', 'int', 'string', 'array')), 'docstring' => 'Unlink a campaign from a zone')); // Merge the plugins' dispatch maps with core. // Function names should be namespaced. $aComponents = OX_Component::getComponents('api'); $aMaps = OX_Component::callOnComponents($aComponents, 'getDispatchMap'); foreach ($aMaps as $map) { $dispatches = array_merge($dispatches, $map); } $server = new XML_RPC_Server($dispatches, 1);
function getComponentGroupObjectsInfo($extends, $group) { require_once LIB_PATH . '/Plugin/Component.php'; $aComponents = OX_Component::getComponents($extends, $group, false, true, false); foreach ($aComponents as &$obj) { $aResult[] = (array) $obj; } return $aResult; //$aGroupInfo['pluginGroupComponents'] = OX_Component::_getComponentFiles($aGroupInfo['extends'], $plugin); }
$title = $setPref[$prefSection]['name']; $translation = new OX_Translation(); $translated_message = $translation->translate($GLOBALS['strXSettingsHaveBeenUpdated'], array(htmlspecialchars($title))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); // The settings configuration file was written correctly, OX_Admin_Redirect::redirect(basename($_SERVER['PHP_SELF'])); } else { // Could not write the settings configuration file, store this // error message and continue $aErrormessage[0][] = $strUnableToWriteConfig; } } // Set the correct section of the settings pages and display the drop-down menu $setPref = $oOptions->getSettingsPreferences($prefSection); $title = $setPref[$prefSection]['name']; // Display the settings page's header and sections $oHeaderModel = new OA_Admin_UI_Model_PageHeaderModel($title); phpAds_PageHeader('account-settings-index', $oHeaderModel); $aComponents = OX_Component::getComponents('geoTargeting'); $aComponentItems = array('none' => $strNone); foreach ($aComponents as $name => $oComponent) { if ($oComponent->enabled) { $aComponentItems[$oComponent->getComponentIdentifier()] = $oComponent->getName(); } } // Prepare an array of HTML elements to display for the form, and // output using the $oOption object $aSettings = array(array('text' => $strGeotargeting, 'items' => array(array('type' => 'select', 'name' => 'geotargeting_type', 'text' => $strGeotargetingType, 'items' => $aComponentItems), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'geotargeting_saveStats', 'text' => $strGeoSaveStats), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'geotargeting_showUnavailable', 'text' => $strGeoShowUnavailable)))); $oOptions->show($aSettings, $aErrormessage); // Display the page footer phpAds_PageFooter();
function insert() { $aConf = $GLOBALS['_MAX']['CONF']; // $this->setEcpmEnabled(); if ($this->priority == self::PRIORITY_ECPM || $this->ecpm_enabled) { $this->ecpm = $this->calculateEcpm(); } // Set the correct campaign status $this->recalculateStatus(); // Set deafult connection windows if not supplied if (!isset($this->viewwindow) && !empty($aConf['logging']['defaultImpressionConnectionWindow'])) { $this->viewwindow = $aConf['logging']['defaultImpressionConnectionWindow']; } if (!isset($this->clickwindow) && !empty($aConf['logging']['defaultClickConnectionWindow'])) { $this->clickwindow = $aConf['logging']['defaultClickConnectionWindow']; } $id = parent::insert(); if (!$id) { return $id; } // Initalise any tracker based plugins $plugins = array(); require_once LIB_PATH . '/Plugin/Component.php'; $invocationPlugins =& OX_Component::getComponents('invocationTags'); foreach ($invocationPlugins as $pluginKey => $plugin) { if (!empty($plugin->trackerEvent)) { $plugins[] = $plugin; } } // Link automatically any trackers which are marked as "link with any new campaigns" $doTrackers = $this->factory('trackers'); $doTrackers->clientid = $this->clientid; $doTrackers->linkcampaigns = 't'; $doTrackers->find(); while ($doTrackers->fetch()) { $doCampaigns_trackers = $this->factory('campaigns_trackers'); $doCampaigns_trackers->init(); $doCampaigns_trackers->trackerid = $doTrackers->trackerid; $doCampaigns_trackers->campaignid = $this->campaignid; $doCampaigns_trackers->clickwindow = $doTrackers->clickwindow; $doCampaigns_trackers->viewwindow = $doTrackers->viewwindow; $doCampaigns_trackers->status = $doTrackers->status; foreach ($plugins as $oPlugin) { $fieldName = strtolower($oPlugin->trackerEvent); $doCampaigns_trackers->{$fieldName} = $doTrackers->{$fieldName}; } $doCampaigns_trackers->insert(); } return $id; }
require_once MAX_PATH . '/lib/max/Plugin/Translation.php'; require_once MAX_PATH . '/lib/OX/Plugin/Component.php'; require_once MAX_PATH . '/www/admin/config.php'; // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN); // Load translation class $oTranslation = new OX_Translation(); // Create a new option object for displaying the setting's page's HTML form $oOptions = new OA_Admin_Option('settings'); $prefSection = "banner-delivery"; // This page depends on deliveryCacheStore plugins, so get the required // information about all such plugins installed in this installation $aDeliveryCacheStores = OX_Component::getComponents('deliveryCacheStore', null, false); // This page depends on 3rdPartyServers plugins, so get the required // information about all such plugins installed in this installation] $a3rdPartyServers =& OX_Component::getComponents('3rdPartyServers'); // Prepare an array for storing error messages $aErrormessage = array(); // If the settings page is a submission, deal with the form data if (isset($_POST['submitok']) && $_POST['submitok'] == 'true') { // Prepare an array of the HTML elements to process, and the // location to save the values in the settings configuration // file $aElements = array(); // Banner Delivery Cache Settings $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
$translation = new OX_Translation(); $translated_message = $translation->translate($GLOBALS['strXSettingsHaveBeenUpdated'], array(htmlspecialchars($title))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); // The settings configuration file was written correctly, OX_Admin_Redirect::redirect(basename($_SERVER['SCRIPT_NAME'])); } // Could not write the settings configuration file, store this // error message and continue $aErrormessage[0][] = $strUnableToWriteConfig; } // Set the correct section of the settings pages and display the drop-down menu $setPref = $oOptions->getSettingsPreferences($prefSection); $title = $setPref[$prefSection]['name']; // Display the settings page's header and sections $oHeaderModel = new OA_Admin_UI_Model_PageHeaderModel($title); phpAds_PageHeader('account-settings-index', $oHeaderModel); // Prepare an array of HTML elements to display for the form, and // output using the $oOption object $aSettings = array(array('text' => $strGeneralSettings, 'items' => array(array('type' => 'checkbox', 'name' => 'ui_enabled', 'text' => $uiEnabled), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_applicationName', 'text' => $strAppName, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_headerFilePath', 'text' => $strMyHeader, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_footerFilePath', 'text' => $strMyFooter, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_logoFilePath', 'text' => $strMyLogo, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_headerForegroundColor', 'text' => $strGuiHeaderForegroundColor, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_headerBackgroundColor', 'text' => $strGuiHeaderBackgroundColor, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_headerActiveTabColor', 'text' => $strGuiActiveTabColor, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'ui_headerTextColor', 'text' => $strGuiHeaderTextColor, 'size' => 35), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'ui_gzipCompression', 'text' => $strGzipContentCompression))), array('text' => $strSSLSettings, 'items' => array(array('type' => 'checkbox', 'name' => 'openads_requireSSL', 'text' => $requireSSL), array('type' => 'break'), array('type' => 'text', 'name' => 'openads_sslPort', 'text' => $sslPort, 'check' => 'wholeNumber'))), array('text' => $strDashboardSettings, 'items' => array(array('type' => 'checkbox', 'name' => 'ui_dashboardEnabled', 'text' => $GLOBALS['_MAX']['CONF']['sync']['checkForUpdates'] ? $strEnableDashboard : $strEnableDashboardSyncNotice, 'disabled' => !$GLOBALS['_MAX']['CONF']['sync']['checkForUpdates'])))); $aAuthPlugins = OX_Component::getComponents('authentication'); if (!empty($aAuthPlugins) && is_array($aAuthPlugins)) { // Add the 'none' (internal) authentication scheme to the list $aItems = array('none' => 'None (internal)'); foreach ($aAuthPlugins as $oAuthPlugin) { $aItems[$oAuthPlugin->getComponentIdentifier()] = $oAuthPlugin->getName(); } $aSettings[] = array('text' => 'Authentication mechanism', 'items' => array(array('type' => 'select', 'name' => 'authentication_type', 'text' => 'Select the plugin-component to be used for authentication', 'items' => $aItems))); } $oOptions->show($aSettings, $aErrormessage); // Display the page footer phpAds_PageFooter();
/** * 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 .= " <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'> <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'> "; $buffer .= "<a href='javascript:max_CopyClipboard(\"bannercode\");'>" . $GLOBALS['strCopyToClipboard'] . "</a></td></tr>"; } else { $buffer .= "<td> </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'> <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'> </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; }
/** * Returns array of allowed invocation tags * * @return array of allowed invocation tags (strings) */ function getAllowedTags() { $aAllowedTags = array(); $invocationTags =& OX_Component::getComponents('invocationTags'); foreach ($invocationTags as $pluginKey => $invocationTag) { if ($invocationTag->isAllowed(null, null)) { $aAllowedTags[] = $pluginKey; } } return $aAllowedTags; }
/** * A private method to calculate an equivalent "last time that maintenance * statistics was run" value from logged delivery data, if possible. * * Enables the MSE process to be kick-started for new installations, where * the MSE has not been run before; but without causing the MSE to run * until the installation is actually logging data. * * @access private * @param integer $type The update type that "occurred" - that is, * OX_DAL_MAINTENANCE_STATISTICS_UPDATE_OI if the required * calculated "update date" needs to be in terms of the * operation interval; or * OX_DAL_MAINTENANCE_STATISTICS_UPDATE_HOUR if the * required calculated "update date" needs to be in terms * of the hour. * @return Date A Date representing the end of the operation interval * which is before the date found of the earliest known * logged delivery data record. Returns null if no logged * delivery data can be located. */ function _getEarliestLoggedDeliveryData($type) { // Obtain all components from the deliveryLog plugin group $aDeliveryLogComponents = OX_Component::getComponents('deliveryLog'); // Are there any components? if (empty($aDeliveryLogComponents)) { return null; } // Call the "getEarliestLoggedDataDate()" method on each // component, to find out what is the date of the earliest // logged data that the component knows about $aResult = OX_Component::callOnComponents($aDeliveryLogComponents, 'getEarliestLoggedDataDate'); if ($aResults === false) { return null; } // Iterate over the results from above, and see if any of // the components returned valid dates, and if so, which // of the results is the earliest $oDate = null; foreach ($aResult as $oComponentDate) { if (is_a($oComponentDate, 'Date')) { // Logged data was located! Is this date earlier than // any previous "earliest" logged delivery data? if (is_null($oDate)) { $oDate = new Date(); $oDate->copy($oComponentDate); } else { if ($oComponentDate->before($oDate)) { $oDate->copy($oComponentDate); } } } } // Was a date found? if (is_null($oDate) || !is_a($oDate, 'Date')) { return null; } // Convert the located earliest logged data date into either the // end of the previous operation interval, or the end of the previous // hour, depending on the required type if ($type == OX_DAL_MAINTENANCE_STATISTICS_UPDATE_OI) { $aDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oDate); } else { $aDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oDate, 60); } // Return the date return $aDates['end']; }