$query = "SELECT m.campaignid as campaignid" . " FROM " . $phpAds_config['tbl_clients'] . " AS c" . "," . $phpAds_config['tbl_campaigns'] . " AS m" . " WHERE c.clientid=" . $clientid . " AND m.campaignid=" . $campaignid . " AND m.clientid=c.clientid" . " AND c.agencyid=" . phpAds_getUserID(); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* Client interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Client)) { if (phpAds_isAllowed(phpAds_ModifyBanner)) { $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tcampaignid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\tWHERE\n\t\t\t\tbannerid = '{$bannerid}'\n\t\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["campaignid"] == '' || phpAds_getUserID() != phpAds_getCampaignParentClientID($row["campaignid"])) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } else { $campaignid = $row["campaignid"]; } } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* Process submitted form */ /*********************************************************/ if (isset($submit)) { // Delete uploaded var for security
} /*********************************************************/ /* HTML framework */ /*********************************************************/ if (isset($Session['prefs']['stats-advertiser-campaigns.php']['listorder'])) { $navorder = $Session['prefs']['stats-advertiser-campaigns.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['stats-advertiser-campaigns.php']['orderdirection'])) { $navdirection = $Session['prefs']['stats-advertiser-campaigns.php']['orderdirection']; } else { $navdirection = ''; } if (phpAds_isUser(phpAds_Client)) { if (phpAds_getUserID() == phpAds_getCampaignParentClientID($campaignid)) { $res = phpAds_dbQuery("SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid= " . phpAds_getUserID() . phpAds_getCampaignListOrder($navorder, $navdirection)) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } phpAds_PageHeader("1.2.4"); echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("1.2.1", "1.2.2", "1.2.3", "1.2.4")); } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection);
function phpAds_showZoneBanners($zoneId) { $pref = $GLOBALS['_MAX']['PREF']; global $phpAds_TextDirection; global $strUntitled, $strName, $strID, $strWeight, $strShowBanner; global $strCampaignWeight, $strBannerWeight, $strProbability, $phpAds_TextAlignRight, $phpAds_TextAlignLeft; global $strRawQueryString, $strZoneProbListChain, $strZoneProbNullPri, $strZoneProbListChainLoop; global $strExclusiveAds, $strHighAds, $strLowAds, $strECPMAds, $strLimitations, $strCapping, $strNoLimitations, $strPriority; MAX_Dal_Delivery_Include(); $aZoneLinkedAds = OA_Dal_Delivery_getZoneLinkedAds($zoneId); if (empty($aZoneLinkedAds['xAds']) && empty($aZoneLinkedAds['ads']) && empty($aZoneLinkedAds['lAds']) && empty($aZoneLinkedAds['eAds'])) { echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"; echo "<tr height='25'><th align='{$phpAds_TextAlignLeft}' colspan='5'><strong>{$strZoneProbNullPri}</strong></th></tr>"; echo "</table>"; } else { $usedHighProbability = 0; echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"; // Exclusive Advertisements if (!empty($aZoneLinkedAds['xAds'])) { echo "<tr height='25'><th align='{$phpAds_TextAlignLeft}' colspan='6'><strong>{$strExclusiveAds}:</strong></th></tr>"; echo "<tr height='25'>"; echo "<td height='25' width='40%'> <b>" . $strName . "</b></td>"; echo "<td height='25'><b>" . $strID . "</b> </td>"; echo "<td height='25'> </td>"; echo "<td height='25'> </td>"; echo "<td height='25'><b>{$strLimitations}</b></td>"; echo "<td height='25' align='" . $phpAds_TextAlignRight . "'> </td>"; echo "</tr>"; echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; $i = -1; foreach ($aZoneLinkedAds['xAds'] as $adId => $aLinkedAd) { $i++; $name = phpAds_getBannerName($adId, 60, false); echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td></tr>"; echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td height='25'>"; echo " "; // Banner icon if ($aLinkedAd['type'] == 'html') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'txt') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'url') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'> "; } else { echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'> "; } // Name if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { echo "<a href='banner-edit.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid=" . $aLinkedAd['placement_id'] . "&bannerid=" . $adId . "'>" . htmlspecialchars($name) . "</a>"; } else { echo htmlspecialchars($name); } echo "</td>"; echo "<td height='25'>" . $adId . "</td>"; echo "<td height='25'> </td>"; echo "<td height='25'> </td>"; $capping = _isAdCapped($aLinkedAd); $limitations = _isAdLimited($aLinkedAd); echo "<td height='25'>"; if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $linkStart = "<a href='banner-acl.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid={$aLinkedAd['placement_id']}&bannerid={$aLinkedAd['ad_id']}'>"; $linkEnd = "</a>"; } else { $linkStart = ''; $linkEnd = ''; } if (!$capping && !$limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-no-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}<strong>{$strNoLimitations}</strong>{$linkEnd}"; } elseif ($limitations && $capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations} & {$strCapping}{$linkEnd}"; } elseif ($limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations}{$linkEnd}"; } elseif ($capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'> {$linkStart}{$strCapping}{$linkEnd}"; } echo "</td>"; // Show banner if ($aLinkedAd['type'] == 'txt') { $width = 300; $height = 200; } else { $width = $aLinkedAd['width'] + 64; $height = $aLinkedAd['bannertext'] ? $aLinkedAd['height'] + 90 : $aLinkedAd['height'] + 64; } echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>"; echo "<img src='" . OX::assetPath() . "/images/icon-zoom.gif' align='absmiddle' border='0'> "; echo "<a href='banner-htmlpreview.php?bannerid=" . $adId . "' target='_new' "; echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=" . $adId . "', '', 'status=no,scrollbars=no,resizable=no,width=" . $width . ",height=" . $height . "');\">"; echo $strShowBanner . "</a> "; echo "</td>"; echo "</tr>"; } echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td colspan='6'><br /><br /></td></tr>"; } // High-Priority Advertisements if (!empty($aZoneLinkedAds['ads'])) { echo "<tr height='25'><th align='{$phpAds_TextAlignLeft}' colspan='6'><strong>{$strHighAds}:</strong></th></tr>"; echo "<tr height='25'>"; echo "<td height='25' width='40%'><b> " . $strName . "</b></td>"; echo "<td height='25'><b>" . $strID . " </b></td>"; echo "<td height='25'><b>" . $strProbability . "</b></td>"; echo "<td height='25'><b>{$strPriority}</b></td>"; echo "<td height='25'><b>{$strLimitations}</b></td>"; echo "<td height='25' align='" . $phpAds_TextAlignRight . "'> </td>"; echo "</tr>"; echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; for ($i = 10; $i > 0; $i--) { if (empty($aZoneLinkedAds['ads'][$i])) { continue; } foreach ($aZoneLinkedAds['ads'][$i] as $adId => $aLinkedAd) { $name = phpAds_getBannerName($adId, 60, false); echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td></tr>"; echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td height='25'>"; echo " "; // Banner icon if ($aLinkedAd['type'] == 'html') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'txt') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'url') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'> "; } else { echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'> "; } // Name if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { echo "<a href='banner-edit.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid=" . $aLinkedAd['placement_id'] . "&bannerid=" . $adId . "'>" . htmlspecialchars($name) . "</a>"; } else { echo htmlspecialchars($name); } echo "</td>"; echo "<td height='25'>" . $adId . "</td>"; // Probability $probability = $aLinkedAd['priority'] * 100; $usedHighProbability += $aLinkedAd['priority']; $exactProbability = $probability == 0 ? '0.00' : sprintf('%0.64f', $probability); echo "<td height='25'><acronym title='{$exactProbability}%'>" . number_format($probability, $pref['ui_percentage_decimals']) . "%</acronym></td>"; // Priority echo "<td height='25'>{$aLinkedAd['campaign_priority']}/10</td>"; $capping = _isAdCapped($aLinkedAd); $limitations = _isAdLimited($aLinkedAd); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $linkStart = "<a href='banner-acl.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid={$aLinkedAd['placement_id']}&bannerid={$aLinkedAd['ad_id']}'>"; $linkEnd = "</a>"; } else { $linkStart = ''; $linkEnd = ''; } echo "<td height='25'>"; if (!$capping && !$limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-no-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strNoLimitations}{$linkEnd}"; } elseif ($limitations && $capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations} & {$strCapping}{$linkEnd}"; } elseif ($limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations}{$linkEnd}"; } elseif ($capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'> {$linkStart}{$strCapping}{$linkEnd}"; } echo "</td>"; // Show banner if ($aLinkedAd['type'] == 'txt') { $width = 300; $height = 200; } else { $width = $aLinkedAd['width'] + 64; $height = $aLinkedAd['bannertext'] ? $aLinkedAd['height'] + 90 : $aLinkedAd['height'] + 64; } echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>"; echo "<img src='" . OX::assetPath() . "/images/icon-zoom.gif' align='absmiddle' border='0'> "; echo "<a href='banner-htmlpreview.php?bannerid=" . $adId . "' target='_new' "; echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=" . $adId . "', '', 'status=no,scrollbars=no,resizable=no,width=" . $width . ",height=" . $height . "');\">"; echo $strShowBanner . "</a> "; echo "</td>"; echo "</tr>"; } } echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td colspan='6'><br /><br /></td></tr>"; } // eCPM Advertisements if (!empty($aZoneLinkedAds['eAds'])) { echo "<tr height='25'><th align='{$phpAds_TextAlignLeft}' colspan='6'><strong>{$strECPMAds}:</strong></th></tr>"; echo "<tr height='25'>"; echo "<td height='25' width='40%'><b> " . $strName . "</b></td>"; echo "<td height='25'><b>" . $strID . " </b></td>"; echo "<td height='25'><b>" . $strProbability . "</b></td>"; echo "<td height='25'><b>{$strLimitations}</b></td>"; echo "<td height='25' align='" . $phpAds_TextAlignRight . "'> </td>"; echo "</tr>"; echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; foreach ($aZoneLinkedAds['eAds'] as $adId => $aLinkedAd) { $name = phpAds_getBannerName($adId, 60, false); echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td></tr>"; echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td height='25'>"; echo " "; // Banner icon if ($aLinkedAd['type'] == 'html') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'txt') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'url') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'> "; } else { echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'> "; } // Name if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { echo "<a href='banner-edit.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid=" . $aLinkedAd['placement_id'] . "&bannerid=" . $adId . "'>" . htmlspecialchars($name) . "</a>"; } else { echo htmlspecialchars($name); } echo "</td>"; echo "<td height='25'>" . $adId . "</td>"; // Probability $probability = $aLinkedAd['priority'] * 100; $usedHighProbability += $aLinkedAd['priority']; $exactProbability = $probability == 0 ? '0.00' : sprintf('%0.64f', $probability); echo "<td height='25'><acronym title='{$exactProbability}%'>" . number_format($probability, $pref['ui_percentage_decimals']) . "%</acronym></td>"; $capping = _isAdCapped($aLinkedAd); $limitations = _isAdLimited($aLinkedAd); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $linkStart = "<a href='banner-acl.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid={$aLinkedAd['placement_id']}&bannerid={$aLinkedAd['ad_id']}'>"; $linkEnd = "</a>"; } else { $linkStart = ''; $linkEnd = ''; } echo "<td height='25'>"; if (!$capping && !$limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-no-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strNoLimitations}{$linkEnd}"; } elseif ($limitations && $capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations} & {$strCapping}{$linkEnd}"; } elseif ($limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations}{$linkEnd}"; } elseif ($capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'> {$linkStart}{$strCapping}{$linkEnd}"; } echo "</td>"; // Show banner if ($aLinkedAd['type'] == 'txt') { $width = 300; $height = 200; } else { $width = $aLinkedAd['width'] + 64; $height = $aLinkedAd['bannertext'] ? $aLinkedAd['height'] + 90 : $aLinkedAd['height'] + 64; } echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>"; echo "<img src='" . OX::assetPath() . "/images/icon-zoom.gif' align='absmiddle' border='0'> "; echo "<a href='banner-htmlpreview.php?bannerid=" . $adId . "' target='_new' "; echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=" . $adId . "', '', 'status=no,scrollbars=no,resizable=no,width=" . $width . ",height=" . $height . "');\">"; echo $strShowBanner . "</a> "; echo "</td>"; echo "</tr>"; } echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td colspan='5'><br /><br /></td></tr>"; } // Low-Priority Advertisements if (!empty($aZoneLinkedAds['lAds'])) { echo "<tr height='25'><th align='{$phpAds_TextAlignLeft}' colspan='6'><strong>{$strLowAds}:</strong></th></tr>"; echo "<tr height='25'>"; echo "<td height='25' width='40%'><b> " . $strName . "</b></td>"; echo "<td height='25'><b>" . $strID . " </b></td>"; echo "<td height='25'><b>" . $strProbability . "</b></td>"; echo "<td height='25'><b>{$strWeight}</b></td>"; echo "<td height='25'><b>{$strLimitations}</b></td>"; echo "<td height='25' align='" . $phpAds_TextAlignRight . "'> </td>"; echo "</tr>"; echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; $ofPriority = (1 - $usedHighProbability) * 100; if ($ofPriority < 0) { $ofPriority = 0; } foreach ($aZoneLinkedAds['lAds'] as $adId => $aLinkedAd) { $name = phpAds_getBannerName($adId, 60, false); echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td></tr>"; echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td height='25'>"; echo " "; // Banner icon if ($aLinkedAd['type'] == 'html') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'txt') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'> "; } elseif ($aLinkedAd['type'] == 'url') { echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'> "; } else { echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'> "; } // Name if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { echo "<a href='banner-edit.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid=" . $aLinkedAd['placement_id'] . "&bannerid=" . $adId . "'>" . htmlspecialchars($name) . "</a>"; } else { echo htmlspecialchars($name); } echo "</td>"; echo "<td height='25'>" . $adId . "</td>"; // Probability $probability = $aLinkedAd['priority'] / $aZoneLinkedAds['priority']['lAds'] * 100; $realProbability = $probability * $ofPriority / 100; $exactProbability = sprintf("%0.64f", $realProbability); echo "<td height='25'><acronym title='{$exactProbability}'>" . number_format($realProbability, $pref['ui_percentage_decimals']) . "%</acronym> (" . number_format($probability, $pref['ui_percentage_decimals']) . "% of " . number_format($ofPriority, $pref['ui_percentage_decimals']) . "%)</td>"; // Weight $weight = $aLinkedAd['campaign_weight'] * $aLinkedAd['weight']; echo "<td height='25'>{$weight}</td>"; // Limitations $capping = _isAdCapped($aLinkedAd); $limitations = _isAdLimited($aLinkedAd); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $linkStart = "<a href='banner-acl.php?clientid=" . phpAds_getCampaignParentClientID($aLinkedAd['placement_id']) . "&campaignid={$aLinkedAd['placement_id']}&bannerid={$aLinkedAd['ad_id']}'>"; $linkEnd = "</a>"; } else { $linkStart = ''; $linkEnd = ''; } echo "<td height='25'>"; if (!$capping && !$limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-no-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strNoLimitations}{$linkEnd}"; } elseif ($limitations && $capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations} & {$strCapping}{$linkEnd}"; } elseif ($limitations) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'> {$linkStart}{$strLimitations}{$linkEnd}"; } elseif ($capping) { echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'> {$linkStart}{$strCapping}{$linkEnd}"; } echo "</td>"; // Show banner if ($aLinkedAd['type'] == 'txt') { $width = 300; $height = 200; } else { $width = $aLinkedAd['width'] + 64; $height = $aLinkedAd['bannertext'] ? $aLinkedAd['height'] + 90 : $aLinkedAd['height'] + 64; } echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>"; echo "<img src='" . OX::assetPath() . "/images/icon-zoom.gif' align='absmiddle' border='0'> "; echo "<a href='banner-htmlpreview.php?bannerid=" . $adId . "' target='_new' "; echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=" . $adId . "', '', 'status=no,scrollbars=no,resizable=no,width=" . $width . ",height=" . $height . "');\">"; echo $strShowBanner . "</a> "; echo "</td>"; echo "</tr>"; } echo "<tr height='1'><td colspan='6' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; } echo "</table>"; echo "<br /><br />"; } }
function phpAds_showZoneBanners($zoneid) { global $phpAds_config, $phpAds_TextDirection; global $strUntitled, $strName, $strID, $strWeight, $strShowBanner; global $strCampaignWeight, $strBannerWeight, $strProbability, $phpAds_TextAlignRight; global $strRawQueryString, $strZoneProbListChain, $strZoneProbNullPri, $strZoneProbListChainLoop; $zonechain = array(); $what = ''; $infinite_loop = false; while ($zoneid || $what) { if ($zoneid) { // Get zone $zoneres = phpAds_dbQuery("SELECT what,width,height,delivery FROM " . $phpAds_config['tbl_zones'] . " WHERE zoneid='{$zoneid}' "); if (phpAds_dbNumRows($zoneres) > 0) { $zone = phpAds_dbFetchArray($zoneres); // Set what parameter to zone settings if (isset($zone['what']) && $zone['what'] != '') { $what = $zone['what']; } else { $what = 'default'; } } else { $what = ''; } $precondition = ''; // Size preconditions if ($zone['width'] > -1) { $precondition .= " AND " . $phpAds_config['tbl_banners'] . ".width = " . $zone['width'] . " "; } if ($zone['height'] > -1) { $precondition .= " AND " . $phpAds_config['tbl_banners'] . ".height = " . $zone['height'] . " "; } // Text Ads preconditions if ($zone['delivery'] == phpAds_ZoneText) { $precondition .= " AND " . $phpAds_config['tbl_banners'] . ".storagetype = 'txt' "; } else { $precondition .= " AND " . $phpAds_config['tbl_banners'] . ".storagetype <> 'txt' "; } if (!defined('LIBVIEWQUERY_INCLUDED')) { include phpAds_path . '/libraries/lib-view-query.inc.php'; } $select = phpAds_buildQuery($what, false, $precondition); } else { // Direct selection if (!defined('LIBVIEWQUERY_INCLUDED')) { include phpAds_path . '/libraries/lib-view-query.inc.php'; } $select = phpAds_buildQuery($what, false, ''); $zone = array('what' => $what); } $res = phpAds_dbQuery($select); $rows = array(); $prioritysum = 0; while ($tmprow = phpAds_dbFetchArray($res)) { // weight of 0 disables the banner if ($tmprow['priority']) { $prioritysum += $tmprow['priority']; $rows[$tmprow['bannerid']] = $tmprow; } } if (!count($rows) && isset($zone['chain']) && strlen($zone['chain'])) { // Follow the chain if no banner was found if (ereg('^zone:([0-9]+)$', $zone['chain'], $match)) { // Zone chain $zoneid = $match[1]; $what = ''; } else { // Raw querystring chain $zoneid = 0; $what = $zone['chain']; } if (in_array($zone, $zonechain)) { // Chain already evaluated, exit $zoneid = 0; $what = ''; $infinite_loop = true; } else { $zonechain[] = $zone; } } else { // No chain settings, exit loop $zoneid = 0; $what = ''; } } if (isset($rows) && is_array($rows)) { $i = 0; if (count($zonechain)) { // Zone Chain echo "<br><br><div class='errormessage'><img class='errormessage' src='images/info.gif' width='16' height='16' border='0' align='absmiddle'>"; echo $infinite_loop ? $strZoneProbListChainLoop : $strZoneProbListChain; echo "<br><img src='images/break-el.gif' height='1' width='100%' vspace='6'><br>"; // echo "</div>"; /* echo "<br><br><table width='100% border='0' align='center' cellspacing='0' cellpadding='0'>"; echo "<tr><td valign='top'><img src='images/info.gif' align='absmiddle'> </td>"; echo "<td width='100%'><b>".($infinite_loop ? $strZoneProbListChainLoop : $strZoneProbListChain)."</b></td></tr>"; echo "</table>"; phpAds_ShowBreak(); */ while (list(, $z) = each($zonechain)) { echo "<nobr><img src='images/icon-zone-d.gif' align='absmiddle'> " . phpAds_buildZoneName($z['zoneid'], $z['zonename']); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'></nobr> "; } if (isset($zone['zoneid'])) { echo "<nobr><img src='images/" . ($infinite_loop ? 'errormessage.gif' : 'icon-zone.gif') . "' align='absmiddle'> <b>" . phpAds_buildZoneName($zone['zoneid'], $zone['zonename']) . "</b></nobr><br>"; } else { echo "<nobr><img src='images/icon-generatecode.gif' align='absmiddle'> <b>" . $GLOBALS['strRawQueryString'] . ":</b> " . htmlentities($zone['what']) . "</nobr><br>"; } echo "</div>"; } // Header echo "<br><br>"; echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"; echo "<tr height='25'>"; echo "<td height='25' width='40%'><b> " . $strName . "</b></td>"; echo "<td height='25'><b>" . $strID . " </b></td>"; echo "<td height='25'><b>" . $strProbability . "</b></td>"; echo "<td height='25' align='" . $phpAds_TextAlignRight . "'> </td>"; echo "</tr>"; echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; // Banners for (reset($rows); $key = key($rows); next($rows)) { $name = phpAds_getBannerName($rows[$key]['bannerid'], 60, false); if ($i > 0) { echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>"; } echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td height='25'>"; echo " "; // Banner icon if ($rows[$key]['storagetype'] == 'html') { echo "<img src='images/icon-banner-html.gif' align='absmiddle'> "; } elseif ($rows[$key]['storagetype'] == 'txt') { echo "<img src='images/icon-banner-text.gif' align='absmiddle'> "; } elseif ($rows[$key]['storagetype'] == 'url') { echo "<img src='images/icon-banner-url.gif' align='absmiddle'> "; } else { echo "<img src='images/icon-banner-stored.gif' align='absmiddle'> "; } // Name if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { echo "<a href='banner-edit.php?clientid=" . phpAds_getCampaignParentClientID($rows[$key]['campaignid']) . "&campaignid=" . $rows[$key]['campaignid'] . "&bannerid=" . $rows[$key]['bannerid'] . "'>" . $name . "</a>"; } else { echo $name; } echo "</td>"; echo "<td height='25'>" . $rows[$key]['bannerid'] . "</td>"; echo "<td height='25'>" . number_format($rows[$key]['priority'] / $prioritysum * 100, $phpAds_config['percentage_decimals']) . "%</td>"; // Show banner if ($rows[$key]['contenttype'] == 'txt') { $width = 300; $height = 200; } else { $width = $rows[$key]['width'] + 64; $height = $rows[$key]['bannertext'] ? $rows[$key]['height'] + 90 : $rows[$key]['height'] + 64; } echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>"; echo "<a href='banner-htmlpreview.php?bannerid=" . $rows[$key]['bannerid'] . "' target='_new' "; echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=" . $rows[$key]['bannerid'] . "', '', 'status=no,scrollbars=no,resizable=no,width=" . $width . ",height=" . $height . "');\">"; echo "<img src='images/icon-zoom.gif' align='absmiddle' border='0'> " . $strShowBanner . "</a> "; echo "</td>"; echo "</tr>"; $i++; } if (!$i) { echo "<tr height='25' bgcolor='#F6F6F6'>"; echo "<td colspan='4'> " . $strZoneProbNullPri . "</td>"; echo "</tr>"; } // Footer echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "</table>"; } }
if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } // Move the banner $res = phpAds_dbQuery("UPDATE " . $phpAds_config['tbl_banners'] . " SET campaignid=" . $moveto . " WHERE bannerid=" . $bannerid) or phpAds_sqlDie(); // Rebuild priorities phpAds_PriorityCalculate(); // Rebuild cache if (!defined('LIBVIEWCACHE_INCLUDED')) { include phpAds_path . '/libraries/deliverycache/cache-' . $phpAds_config['delivery_caching'] . '.inc.php'; } phpAds_cacheDelete(); // Get new clientid $clientid = phpAds_getCampaignParentClientID($moveto); Header("Location: " . $returnurl . "?clientid=" . $clientid . "&campaignid=" . $moveto . "&bannerid=" . $bannerid); } elseif (isset($applyto_x) && $applyto != '') { if (phpAds_isUser(phpAds_Agency)) { $query = "SELECT " . $phpAds_config['tbl_banners'] . ".bannerid as bannerid" . " FROM " . $phpAds_config['tbl_clients'] . "," . $phpAds_config['tbl_campaigns'] . "," . $phpAds_config['tbl_banners'] . " WHERE " . $phpAds_config['tbl_banners'] . ".bannerid=" . $applyto . " AND " . $phpAds_config['tbl_banners'] . ".campaignid=" . $phpAds_config['tbl_campaigns'] . ".campaignid" . " AND " . $phpAds_config['tbl_campaigns'] . ".clientid=" . $phpAds_config['tbl_clients'] . ".clientid" . " AND " . $phpAds_config['tbl_clients'] . ".agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } // Delete old limitations $res = phpAds_dbQuery("\n\t\t\tDELETE FROM\n\t\t\t\t" . $phpAds_config['tbl_acls'] . "\n\t\t\tWHERE\n\t\t\t\tbannerid = " . $applyto . "\n\t\t") or phpAds_sqlDie(); // Load source limitation $res = phpAds_dbQuery("\n\t\t SELECT\n\t \t *\n\t \t FROM\n\t \t " . $phpAds_config['tbl_acls'] . "\n\t \t WHERE\n\t \t bannerid = '" . $bannerid . "'\n \t ") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) {