function phpAds_buildBannerCode($bannerid, $fullpreview = false) { include_once MAX_PATH . '/lib/max/Delivery/adRender.php'; $aBanner = Admin_DA::getAd($bannerid); $aBanner['storagetype'] = $aBanner['type']; $aBanner['bannerid'] = $aBanner['ad_id']; $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); return $bannerCode; }
/** * Batch linking list of zones to campaign's banners or a specific banner * This is a sub-function of linkZonesToCampaigns and linkZonesToBanner. * * Banners are linked when: * - text text banner and text zone (ignore width/height) * - link non text banners when matching width/height to non text zone * Don't link banners to zone if that link already exists * Don't link Email zones * * @param array $aZonesIds array of zones IDs * @param int $campaignId the campaign ID. * @param int $bannerId the banner ID. * @return int number of linked banners */ function _linkZonesToCampaignsBannersOrSingleBanner($aZonesIds, $campaignId, $bannerId = null) { $prefix = $this->getTablePrefix(); $rsEmailZones = DBC::NewRecordSet("SELECT zoneid FROM {$prefix}zones WHERE delivery = " . MAX_ZoneEmail . " AND zoneid IN (" . implode(',', array_map('intval', $aZonesIds)) . ")"); $aEmailZoneIds = $rsEmailZones->getAll(); $fastLinking = !$GLOBALS['_MAX']['CONF']['audit']['enabledForZoneLinking']; $fromWhereClause = " FROM\n {$prefix}banners AS b\n CROSS JOIN\n {$prefix}zones AS z\n LEFT JOIN {$prefix}ad_zone_assoc AS aza ON (aza.ad_id = b.bannerid AND aza.zone_id = z.zoneid)\n WHERE"; if (!empty($campaignId)) { $fromWhereClause .= "\n b.campaignid = " . DBC::makeLiteral($campaignId) . "\n AND"; foreach ($aEmailZoneIds as $zoneId) { $okToLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $campaignId); if (PEAR::isError($okToLink)) { $aZonesIds = array_diff($aZonesIds, array($zoneId)); } } } if (!empty($bannerId)) { $fromWhereClause .= "\n b.bannerid = " . DBC::makeLiteral($bannerId) . "\n AND"; // Remove any zoneids which this banner cannot be linked to due to email zone restrictions foreach ($aEmailZoneIds as $zoneId) { $aAd = Admin_DA::getAd($bannerId); $okToLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $aAd['placement_id']); if (PEAR::isError($okToLink)) { $aZonesIds = array_diff($aZonesIds, array($zoneId)); } } } $fromWhereClause .= "\n z.zoneid IN (" . implode(",", array_map('intval', $aZonesIds)) . ")\n AND\n (\n (\n b.storagetype = 'txt'\n AND\n z.delivery = " . phpAds_ZoneText . "\n )\n OR\n (\n z.delivery <> " . phpAds_ZoneText . "\n AND\n b.storagetype <> 'txt'\n AND\n (\n (\n ( z.width = -1\n OR\n z.width = b.width\n )\n AND\n ( z.height = -1\n OR\n z.height = b. height\n )\n )\n OR\n (\n b.height = -1 AND b.width = -1\n )\n )\n )\n )\n AND\n aza.ad_zone_assoc_id IS NULL\n "; // if only one zone is selected and this zone is an email zone // we only link it if it was not previously linked to any banner (email zones can be linked to one banner only) if ($fastLinking) { $query = "INSERT INTO {$prefix}ad_zone_assoc (zone_id, ad_id, priority_factor)\n SELECT z.zoneid, b.bannerid, 1\n {$fromWhereClause}\n "; return $this->oDbh->exec($query); } else { $query = "\n SELECT z.zoneid AS zoneid,\n b.bannerid AS bannerid\n {$fromWhereClause}\n "; $rsAdZones = DBC::NewRecordSet($query); if (PEAR::isError($rsAdZones)) { return $rsAdZones; } $aAdZones = $rsAdZones->getAll(); $doAdZoneAssoc = OA_Dal::factoryDO('ad_zone_assoc'); foreach ($aAdZones as $aAdZone) { $doAdZoneAssoc->zone_id = $aAdZone['zoneid']; $doAdZoneAssoc->ad_id = $aAdZone['bannerid']; $doAdZoneAssoc->priority_factor = 1; $doAdZoneAssoc->insert(); } return count($aAdZones); } }
| 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: banner-htmlpreview.php 37157 2009-05-28 12:31:10Z andrew.hill $ */ // Require the initialisation file require_once '../../init.php'; // Required files require_once MAX_PATH . '/www/admin/config.php'; require_once MAX_PATH . '/www/admin/lib-statistics.inc.php'; require_once MAX_PATH . '/lib/max/Delivery/adRender.php'; require_once MAX_PATH . '/lib/max/Admin_DA.php'; /*-------------------------------------------------------*/ /* Main code */ /*-------------------------------------------------------*/ $aBanner = Admin_DA::getAd($bannerid); $aBanner['bannerid'] = $aBanner['ad_id']; if (!empty($aBanner)) { $conf = $GLOBALS['_MAX']['CONF']; $bannerName = strip_tags(phpAds_buildBannerName($bannerid, $aBanner['name'], $aBanner['alt'])); $sizeDescription = $aBanner['type'] == 'txt' ? ' ' : " width: {$aBanner['width']} height: {$aBanner['height']}"; $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); $protocol = $_SERVER['SERVER_PORT'] == $conf['openads']['sslPort'] ? "https" : "http"; $deliveryUrl = $protocol . ':' . MAX_commonConstructPartialDeliveryUrl($conf['file']['flash']); echo "\n<html>\n<head>\n<title>{$bannerName}</title>\n<link rel='stylesheet' href='" . OX::assetPath() . "/css/interface-{$phpAds_TextDirection}.css'>\n<script type='text/javascript' src='{$deliveryUrl}'></script>\n</head>\n<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#EFEFEF'>\n<table cellpadding='0' cellspacing='0' border='0'>\n<tr height='32'>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-tl.gif' width='32' height='32'></td>\n <td background='" . OX::assetPath() . "/images/ruler-top.gif'> </td>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-tr.gif' width='32' height='32'></td>\n</tr>\n<tr height='{$aBanner['height']}'>\n <td width='32' background='" . OX::assetPath() . "/images/ruler-left.gif'> </td>\n <td bgcolor='#FFFFFF' width='{$aBanner['width']}'>\n {$bannerCode}\n </td>\n <td width='32'> </td>\n</tr>\n<tr height='32'>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-bl.gif' width='32' height='32'></td>\n <td>{$sizeDescription}</td>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-br.gif' width='32' height='32'></td>\n</tr>\n</table>\n</body>\n</html>"; }
function MAX_adjustAdZones($adId) { $aAdZones = Admin_DA::getAdZones(array('ad_id' => $adId), true, 'zone_id'); if (!empty($aAdZones)) { $aAd = Admin_DA::getAd($adId); $aZones = Admin_DA::getZones(array('zone_id' => implode(',', array_keys($aAdZones))), true); // get zones linked to this campaign $aPlacementZones = Admin_DA::getPlacementZones(array('placement_id' => $aAd['placement_id']), true, 'zone_id'); foreach ($aZones as $zoneId => $aZone) { if (!MAX_checkAdZoneValid($aZone, $aAd)) { Admin_DA::deleteAdZones(array('zone_id' => $zoneId, 'ad_id' => $adId)); } else { // if ad's campaign is linked to this zone, link ad to zone if (isset($aPlacementZones[$zoneId])) { Admin_DA::addAdZone(array('zone_id' => $zoneId, 'ad_id' => $adId)); } } } } }
function testGetAd() { $id = Admin_DA::addAd(array('campaignid' => rand(1, 999), 'active' => 't', 'contenttype' => 'gif', 'pluginversion' => rand(1, 999), 'htmltemplate' => '<html></html>', 'htmlcache' => '<html><body></body></html>', 'url' => 'http://www.openx.org', 'bannertext' => 'text', 'compiledlimitation' => '', 'append' => '', 'acls_updated' => '2007-04-11', 'status' => 1)); $ret = Admin_DA::getAd($id); // should look like this /* Array ( [ad_id] => 1 [placement_id] => 234234 [active] => t [name] => desc [type] => sql [contenttype] => gif [pluginversion] => 1 [filename] => sdfasdf [imageurl] => http://img.com [htmltemplate] => foo [htmlcache] => bar [width] => 5 [height] => 6 [weight] => 3 [seq] => 1 [target] => [url] => http://localhost/phpMyAdmin/ [alt] => [status] => [bannertext] => asdasdfad [adserver] => [block] => 0 [capping] => 0 [session_capping] => 0 [compiledlimitation] => asdfasdf [append] => asdfasdf [bannertype] => 2 [alt_filename] => [alt_imageurl] => [alt_contenttype] => gif [prepend] => ) */ $this->assertTrue(is_array($ret)); $this->assertTrue(count($ret)); $this->assertTrue(array_key_exists('ad_id', $ret)); $this->assertTrue(array_key_exists('placement_id', $ret)); $this->assertTrue(array_key_exists('status', $ret)); $this->assertEqual(1, $ret['status']); $this->assertTrue(array_key_exists('name', $ret)); $this->assertTrue(array_key_exists('type', $ret)); $this->assertTrue(array_key_exists('contenttype', $ret)); $this->assertTrue(array_key_exists('pluginversion', $ret)); $this->assertTrue(array_key_exists('filename', $ret)); $this->assertTrue(array_key_exists('imageurl', $ret)); $this->assertTrue(array_key_exists('htmltemplate', $ret)); $this->assertTrue(array_key_exists('htmlcache', $ret)); $this->assertTrue(array_key_exists('width', $ret)); $this->assertTrue(array_key_exists('height', $ret)); $this->assertTrue(array_key_exists('weight', $ret)); $this->assertTrue(array_key_exists('seq', $ret)); $this->assertTrue(array_key_exists('target', $ret)); $this->assertTrue(array_key_exists('url', $ret)); $this->assertTrue(array_key_exists('alt', $ret)); $this->assertTrue(array_key_exists('status', $ret)); $this->assertTrue(array_key_exists('bannertext', $ret)); $this->assertTrue(array_key_exists('adserver', $ret)); $this->assertTrue(array_key_exists('block', $ret)); $this->assertTrue(array_key_exists('capping', $ret)); $this->assertTrue(array_key_exists('session_capping', $ret)); $this->assertTrue(array_key_exists('compiledlimitation', $ret)); $this->assertTrue(array_key_exists('prepend', $ret)); $this->assertTrue(array_key_exists('append', $ret)); $this->assertTrue(array_key_exists('bannertype', $ret)); $this->assertTrue(array_key_exists('alt_filename', $ret)); $this->assertTrue(array_key_exists('alt_imageurl', $ret)); $this->assertTrue(array_key_exists('alt_contenttype', $ret)); }
function duplicateAd($adId) { $aAd = Admin_DA::getAd($adId); return Admin_DA::_duplicateAd($aAd, true); }
function MAX_bannerPreview($bannerId) { require_once MAX_PATH . '/lib/max/Delivery/adRender.php'; $aBanner = Admin_DA::getAd($bannerId); $aBanner['storagetype'] = $aBanner['type']; $aBanner['bannerid'] = $aBanner['ad_id']; if ($aBanner['contenttype'] == 'swf') { return MAX_adRender($aBanner, 0, '', '', '', true, '', false, false) . "<br /><br />" . _adRenderImage($aBanner, 0, '', '', true, false, false, true); } else { return MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); } }
/** * Processes submit values of zone form * * @param OA_Admin_UI_Component_Form $form form to process * @return An array of Pear::Error objects if any */ function processForm($form) { $aFields = $form->exportValues(); switch ($aFields['delivery']) { case phpAds_ZoneText: $aFields['width'] = $aFields['height'] = 0; break; case OX_ZoneVideoOverlay: $aFields['width'] = $aFields['height'] = -2; break; case OX_ZoneVideoInstream: $aFields['width'] = $aFields['height'] = -3; break; default: if ($aFields['sizetype'] == 'custom') { if (isset($aFields['width']) && $aFields['width'] == '*') { $aFields['width'] = -1; } if (isset($aFields['height']) && $aFields['height'] == '*') { $aFields['height'] = -1; } } else { list($aFields['width'], $aFields['height']) = explode('x', $aFields['size']); } break; } if (!is_numeric($aFields['oac_category_id']) || $aFields['oac_category_id'] <= 0) { $aFields['oac_category_id'] = 'NULL'; } if (empty($errors)) { // Edit if (!empty($aFields['zoneid'])) { // before we commit any changes to db, store whether the size has changed $aZone = Admin_DA::getZone($aFields['zoneid']); $size_changed = $aFields['width'] != $aZone['width'] || $aFields['height'] != $aZone['height'] ? true : false; $type_changed = $aFields['delivery'] != $aZone['delivery'] ? true : false; $doZones = OA_Dal::factoryDO('zones'); $doZones->zonename = $aFields['zonename']; $doZones->description = $aFields['description']; $doZones->width = $aFields['width']; $doZones->height = $aFields['height']; $doZones->comments = $aFields['comments']; $doZones->delivery = $aFields['delivery']; if ($aFields['delivery'] != phpAds_ZoneText && $aFields['delivery'] != phpAds_ZoneBanner) { $doZones->append = ''; } if ($aFields['delivery'] != phpAds_ZoneText) { $doZones->prepend = ''; } $doZones->oac_category_id = $aFields['oac_category_id']; $doZones->zoneid = $aFields['zoneid']; $doZones->update(); // Ad Networks $doPublisher = OA_Dal::factoryDO('affiliates'); $doPublisher->get($aFields['affiliateid']); $anWebsiteId = $doPublisher->as_website_id; if ($anWebsiteId) { $oAdNetworks = new OA_Central_AdNetworks(); $doZones->get($aFields['zoneid']); $oAdNetworks->updateZone($doZones, $anWebsiteId); } // Reset append codes which called this zone $doZones = OA_Dal::factoryDO('zones'); $doZones->appendtype = phpAds_ZoneAppendZone; if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $doZones->addReferenceFilter('agency', OA_Permission::getEntityId()); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $doZones->addReferenceFilter('affiliates', OA_Permission::getEntityId()); } $doZones->find(); while ($doZones->fetch() && ($row = $doZones->toArray())) { $append = phpAds_ZoneParseAppendCode($row['append']); if ($append[0]['zoneid'] == $aFields['zoneid']) { $doZonesClone = clone $doZones; $doZonesClone->appendtype = phpAds_ZoneAppendRaw; $doZonesClone->append = ''; $doZonesClone->update(); } } if ($type_changed && $aFields['delivery'] == MAX_ZoneEmail) { // Unlink all campaigns/banners linked to this zone $aPlacementZones = Admin_DA::getPlacementZones(array('zone_id' => $aFields['zoneid']), true, 'placement_id'); if (!empty($aPlacementZones)) { foreach ($aPlacementZones as $placementId => $aPlacementZone) { Admin_DA::deletePlacementZones(array('zone_id' => $aFields['zoneid'], 'placement_id' => $placementId)); } } $aAdZones = Admin_DA::getAdZones(array('zone_id' => $aFields['zoneid']), false, 'ad_id'); if (!empty($aAdZones)) { foreach ($aAdZones as $adId => $aAdZone) { Admin_DA::deleteAdZones(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId)); } } } else { if ($size_changed) { $aZone = Admin_DA::getZone($aFields['zoneid']); // Loop through all appended banners and make sure that they still fit... $aAds = Admin_DA::getAdZones(array('zone_id' => $aFields['zoneid']), false, 'ad_id'); if (!empty($aAds)) { foreach ($aAds as $adId => $aAd) { $aAd = Admin_DA::getAd($adId); if ($aZone['type'] == phpAds_ZoneText && $aAd['type'] != 'txt' || $aAd['width'] != $aZone['width'] && $aZone['width'] > -1 || $aAd['height'] != $aZone['height'] && $aZone['height'] > -1) { Admin_DA::deleteAdZones(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId)); } } } // Check if any campaigns linked to this zone have ads that now fit. // If so, link them to the zone. $aPlacementZones = Admin_DA::getPlacementZones(array('zone_id' => $aFields['zoneid']), true); if (!empty($aPlacementZones)) { foreach ($aPlacementZones as $aPlacementZone) { // get ads in this campaign $aAds = Admin_DA::getAds(array('placement_id' => $aPlacementZone['placement_id']), true); foreach ($aAds as $adId => $aAd) { Admin_DA::addAdZone(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId)); } } } } } // Queue confirmation message $translation = new OX_Translation(); $translated_message = $translation->translate($GLOBALS['strZoneHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "zone-edit.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']), htmlspecialchars($aFields['zonename']))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); OX_Admin_Redirect::redirect("zone-edit.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']); } else { $doZones = OA_Dal::factoryDO('zones'); $doZones->affiliateid = $aFields['affiliateid']; $doZones->zonename = $aFields['zonename']; $doZones->zonetype = phpAds_ZoneCampaign; $doZones->description = $aFields['description']; $doZones->comments = $aFields['comments']; $doZones->width = $aFields['width']; $doZones->height = $aFields['height']; $doZones->delivery = $aFields['delivery']; $doZones->oac_category_id = $aFields['oac_category_id']; // The following fields are NOT NULL but do not get values set in the form. // Should these fields be changed to NULL in the schema or should they have a default value? $doZones->category = ''; $doZones->ad_selection = ''; $doZones->chain = ''; $doZones->prepend = ''; $doZones->append = ''; $aFields['zoneid'] = $doZones->insert(); // Ad Networks $doPublisher = OA_Dal::factoryDO('affiliates'); $doPublisher->get($aFields['affiliateid']); $anWebsiteId = $doPublisher->as_website_id; if ($anWebsiteId) { $oAdNetworks = new OA_Central_AdNetworks(); $oAdNetworks->updateZone($doZones, $anWebsiteId); } // Queue confirmation message $translation = new OX_Translation(); $translated_message = $translation->translate($GLOBALS['strZoneHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'zone-edit.php?affiliateid=' . $aFields['affiliateid'] . '&zoneid=' . $aFields['zoneid']), htmlspecialchars($aFields['zonename']))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); OX_Admin_Redirect::redirect("affiliate-zones.php?affiliateid=" . $aFields['affiliateid']); } } return $errors; }
function displayPage($bannerid, $campaignid, $clientid, $bannerTypes, $aBanner, $type, $form, $ext_bannertype, $formDisabled = false) { $pageName = 'advertiser-campaigns'; $aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid); $entityId = OA_Permission::getEntityId(); $entityType = 'advertiser_id'; $aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId)); $aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false); $advertiserId = $aEntities['clientid']; $campaignId = $aEntities['campaignid']; $bannerId = $aEntities['bannerid']; $entityString = _getEntityString($aEntities); $aOtherEntities = $aEntities; unset($aOtherEntities['bannerid']); $otherEntityString = _getEntityString($aOtherEntities); if ($pageName == 'banner-edit.php' && empty($bannerId)) { $tabValue = 'banner-edit_new'; $pageType = 'edit-new'; } else { $pageType = 'edit'; } $advertiserEditUrl = ''; $campaignEditUrl = ''; if (OA_Permission::hasAccessToObject('clients', $advertiserId)) { $advertiserEditUrl = "advertiser-edit.php?clientid={$advertiserId}"; } if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $campaignEditUrl = "campaign-edit.php?clientid={$advertiserId}&campaignid={$campaignId}"; } if ($bannerId && !empty($GLOBALS['_MAX']['PREF']['ui_show_banner_preview']) && empty($_GET['nopreview'])) { require_once MAX_PATH . '/lib/max/Delivery/adRender.php'; $aBanner = Admin_DA::getAd($bannerId); $aBanner['storagetype'] = $aBanner['type']; $aBanner['bannerid'] = $aBanner['ad_id']; $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); } else { $bannerCode = ''; } $advertiserDetails = phpAds_getClientDetails($advertiserId); $advertiserName = $advertiserDetails['clientname']; $campaignDetails = Admin_DA::getPlacement($campaignId); $campaignName = $campaignDetails['name']; $bannerName = $aOtherBanners[$bannerId]['name']; $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder(); $oHeaderModel = $builder->buildEntityHeader(array(array("name" => $advertiserName, "url" => $advertiserEditUrl), array("name" => $campaignName, "url" => $campaignEditUrl), array("name" => $bannerName)), "banner", $pageType); global $phpAds_breadcrumbs_extra; $phpAds_breadcrumbs_extra .= "<div class='bannercode'>{$bannerCode}</div>"; if ($bannerCode != '') { $phpAds_breadcrumbs_extra .= "<br />"; } addPageLinkTool($GLOBALS["strDuplicate"], MAX::constructUrl(MAX_URL_ADMIN, "plugins/oxMarkedTextAdvertiser/banner-modify.php?duplicate=true&clientid={$advertiserId}&campaignid={$campaignId}&bannerid={$bannerId}&returnurl=" . urlencode(basename($_SERVER['SCRIPT_NAME']))), "iconBannerDuplicate"); addPageShortcut($GLOBALS['strBackToBanners'], MAX::constructUrl(MAX_URL_ADMIN, "campaign-banners.php?clientid={$advertiserId}&campaignid={$campaignId}"), "iconBack"); $entityString = _getEntityString($aEntities); addPageShortcut($GLOBALS['strBannerHistory'], MAX::constructUrl(MAX_URL_ADMIN, "stats.php?entity=banner&breakdown=history&{$entityString}"), 'iconStatistics'); phpAds_PageHeader('advertiser-campaigns', $oHeaderModel); $oTpl = new OA_Admin_Template('banner-edit.html'); $oTpl->assign('clientId', $clientid); $oTpl->assign('campaignId', $campaignid); $oTpl->assign('bannerId', $bannerid); $oTpl->assign('bannerTypes', $bannerTypes); $oTpl->assign('bannerType', 'bannerTypeText:oxMarkedText:oxMarkedTextComponent'); $oTpl->assign('bannerHeight', $aBanner["height"]); $oTpl->assign('bannerWidth', $aBanner["width"]); $oTpl->assign('disabled', $formDisabled); $oTpl->assign('form', $form->serialize()); $oTpl->display(); phpAds_PageFooter(); }
function MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities) { global $phpAds_TextDirection; $advertiserId = $aEntities['clientid']; $campaignId = $aEntities['campaignid']; $bannerId = $aEntities['bannerid']; $entityString = _getEntityString($aEntities); $aOtherEntities = $aEntities; unset($aOtherEntities['bannerid']); $otherEntityString = _getEntityString($aOtherEntities); if ($pageName == 'banner-edit.php' && empty($bannerId)) { $tabValue = 'banner-edit_new'; $pageType = 'edit-new'; } else { $pageType = 'edit'; } $advertiserEditUrl = ''; $campaignEditUrl = ''; if (OA_Permission::hasAccessToObject('clients', $advertiserId)) { $advertiserEditUrl = "advertiser-edit.php?clientid={$advertiserId}"; } if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $campaignEditUrl = "campaign-edit.php?clientid={$advertiserId}&campaignid={$campaignId}"; } // Build ad preview if ($bannerId && !empty($GLOBALS['_MAX']['PREF']['ui_show_banner_preview']) && empty($_GET['nopreview'])) { require_once MAX_PATH . '/lib/max/Delivery/adRender.php'; $aBanner = Admin_DA::getAd($bannerId); $aBanner['storagetype'] = $aBanner['type']; $aBanner['bannerid'] = $aBanner['ad_id']; $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); } else { $bannerCode = ''; } $advertiserDetails = phpAds_getClientDetails($advertiserId); $advertiserName = $advertiserDetails['clientname']; $campaignDetails = Admin_DA::getPlacement($campaignId); $campaignName = $campaignDetails['name']; $bannerName = $aOtherBanners[$bannerId]['name']; $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder(); $oHeaderModel = $builder->buildEntityHeader(array(array("name" => $advertiserName, "url" => $advertiserEditUrl), array("name" => $campaignName, "url" => $campaignEditUrl), array("name" => $bannerName)), "banner", $pageType); global $phpAds_breadcrumbs_extra; $phpAds_breadcrumbs_extra .= "<div class='bannercode'>{$bannerCode}</div>"; if ($bannerCode != '') { $phpAds_breadcrumbs_extra .= "<br />"; } addBannerPageTools($advertiserId, $campaignId, $bannerId, $aOtherCampaigns, $aOtherBanners, $aEntities); phpAds_PageHeader($tabValue, $oHeaderModel); }
/* +---------------------------------------------------------------------------+ | Revive Adserver | | http://www.revive-adserver.com | | | | Copyright: See the COPYRIGHT.txt file. | | License: GPLv2 or later, see the LICENSE.txt file. | +---------------------------------------------------------------------------+ */ // Require the initialisation file require_once '../../init.php'; // Required files require_once MAX_PATH . '/www/admin/config.php'; require_once MAX_PATH . '/www/admin/lib-statistics.inc.php'; require_once MAX_PATH . '/lib/max/Delivery/adRender.php'; require_once MAX_PATH . '/lib/max/Admin_DA.php'; /*-------------------------------------------------------*/ /* Main code */ /*-------------------------------------------------------*/ $aBanner = Admin_DA::getAd((int) $bannerid); $aBanner['bannerid'] = $aBanner['ad_id']; if (!empty($aBanner)) { $conf = $GLOBALS['_MAX']['CONF']; $bannerName = strip_tags(phpAds_buildBannerName($bannerid, $aBanner['name'], $aBanner['alt'])); $sizeDescription = $aBanner['type'] == 'txt' ? ' ' : " width: {$aBanner['width']} height: {$aBanner['height']}"; $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); $protocol = $GLOBALS['_MAX']['SSL_REQUEST'] ? "https" : "http"; $deliveryUrl = $protocol . ':' . MAX_commonConstructPartialDeliveryUrl($conf['file']['flash']); echo "\n<html>\n<head>\n<title>{$bannerName}</title>\n<link rel='stylesheet' href='" . OX::assetPath() . "/css/interface-{$phpAds_TextDirection}.css'>\n<script type='text/javascript' src='{$deliveryUrl}'></script>\n</head>\n<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#EFEFEF'>\n<table cellpadding='0' cellspacing='0' border='0'>\n<tr height='32'>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-tl.gif' width='32' height='32'></td>\n <td background='" . OX::assetPath() . "/images/ruler-top.gif'> </td>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-tr.gif' width='32' height='32'></td>\n</tr>\n<tr height='{$aBanner['height']}'>\n <td width='32' background='" . OX::assetPath() . "/images/ruler-left.gif'> </td>\n <td bgcolor='#FFFFFF' width='{$aBanner['width']}'>\n {$bannerCode}\n </td>\n <td width='32'> </td>\n</tr>\n<tr height='32'>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-bl.gif' width='32' height='32'></td>\n <td>{$sizeDescription}</td>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-br.gif' width='32' height='32'></td>\n</tr>\n</table>\n</body>\n</html>"; }
$unlinked_message = $translation->translate($GLOBALS['strXZonesUnlinked'], array($unlinked)); } if ($linked > 0 || $unlinked > 0) { $translated_message = $linked_message . ($linked_message != '' && $unlinked_message != '' ? ', ' : ' ') . $unlinked_message; OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); } Header("Location: banner-zone.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}"); exit; } } // Display navigation $aOtherCampaigns = Admin_DA::getPlacements(array('agency_id' => $agencyId)); $aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignId), false); MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities); // Main code $aAd = Admin_DA::getAd($bannerId); $aParams = array('agency_id' => $agencyId); if ($aAd['type'] == 'txt') { $aParams['zone_type'] = phpAds_ZoneText; } else { $aParams['zone_width'] = $aAd['width'] . ',-1'; $aParams['zone_height'] = $aAd['height'] . ',-1'; } $aPublishers = Admin_DA::getPublishers($aParams, true); $aLinkedZones = Admin_DA::getAdZones(array('ad_id' => $bannerId), false, 'zone_id'); echo "\n<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n<form name='zones' action='{$pageName}' method='post'>\n<input type='hidden' name='clientid' value='{$advertiserId}'>\n<input type='hidden' name='campaignid' value='{$campaignId}'>\n<input type='hidden' name='bannerid' value='{$bannerId}'>"; MAX_displayZoneHeader($pageName, $listorder, $orderdirection, $aEntities); if ($error) { // Message echo "<br>"; echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/errormessage.gif' align='absmiddle'>";