} else { $aEntities = array('agencyid' => $agencyId, 'channelid' => $channelid); $aOtherChannels = Admin_DA::getChannels(array('agency_id' => $agencyId, 'channel_type' => 'agency')); } /*-------------------------------------------------------*/ /* Process submitted form */ /*-------------------------------------------------------*/ if (!empty($action)) { if (empty($acl)) { $acl = array(); } $acl = MAX_AclAdjust($acl, $action); } elseif (!empty($submit)) { $acl = isset($acl) ? $acl : array(); // Only save when inputs are valid if (OX_AclCheckInputsFields($acl, $pageName) === true) { if (MAX_AclSave($acl, $aEntities)) { // Queue confirmation message $doChannel = OA_Dal::factoryDO('channel'); $doChannel->get($channelid); $translation = new OX_Translation(); $translated_message = $translation->translate($GLOBALS['strChannelAclHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "channel-edit.php?" . (!empty($affiliateid) ? "affiliateid={$affiliateid}&" : "") . "channelid={$channelid}"), htmlspecialchars($doChannel->name))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); // Redirect if (!empty($affiliateid)) { header("Location: channel-acl.php?affiliateid={$affiliateid}&channelid={$channelid}"); } else { header("Location: channel-acl.php?channelid={$channelid}"); } exit; }
function setBannerTargeting($bannerId, &$aTargeting) { if ($this->checkIdExistence('banners', $bannerId)) { if (!$this->checkPermissions(null, 'banners', $bannerId)) { return false; } foreach ($aTargeting as $executionOrder => $oTargeting) { // Prepend "deliveryLimitations:" to any component-identifiers // (for 2.6 backwards compatibility) if (substr($oTargeting->type, 0, 20) != 'deliveryLimitations:') { $aTargeting[$executionOrder]->type = 'deliveryLimitations:' . $aTargeting[$executionOrder]->type; } if (!$this->_validateTargeting($oTargeting)) { return false; } } $aTargetingArray = array(); foreach ($aTargeting as $oTargeting) { $aTargetingArray[] = $oTargeting->toArray(); } $res = OX_AclCheckInputsFields($aTargetingArray, false); if ($res !== true) { $this->raiseError($res[0]); return false; } $doBannerTargeting = OA_Dal::factoryDO('acls'); $doBannerTargeting->bannerid = $bannerId; $doBannerTargeting->find(); $doBannerTargeting->delete(); // Create the new targeting options $executionOrder = 0; $aAcls = array(); foreach ($aTargetingArray as $bannerTargetingData) { $doAcl = OA_Dal::factoryDO('acls'); $doAcl->setFrom($bannerTargetingData); $doAcl->bannerid = $bannerId; $doAcl->executionorder = $executionOrder; $doAcl->insert(); $aAcls[$executionOrder] = $doAcl->toArray(); $executionOrder++; } // Recompile the banner's compiledlimitations $doBanner = OA_Dal::factoryDO('banners'); $doBanner->get($bannerId); $doBanner->compiledlimitation = OA_aclGetSLimitationFromAAcls($aAcls); $doBanner->acl_plugins = MAX_AclGetPlugins($aAcls); $doBanner->acls_updated = gmdate(OA_DATETIME_FORMAT); $doBanner->update(); return true; } else { $this->raiseError('Unknown bannerId Error'); return false; } }
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>"; }