function phpAds_showBanners()
{
    global $phpAds_config;
    global $strUntitled, $strName, $strID, $strWeight;
    global $strProbability, $strPriority, $strRecalculatePriority;
    global $phpAds_TextDirection;
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tORDER BY\n\t\t\tpriority DESC\n\t");
    $rows = array();
    $prioritysum = 0;
    while ($tmprow = phpAds_dbFetchArray($res)) {
        if ($tmprow['priority']) {
            $prioritysum += $tmprow['priority'];
            $rows[$tmprow['bannerid']] = $tmprow;
        }
    }
    if (is_array($rows)) {
        $i = 0;
        // Header
        echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>";
        echo "<tr height='25'>";
        echo "<td height='25'><b>&nbsp;&nbsp;" . $strName . "</b></td>";
        echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
        echo "<td height='25'><b>" . $strPriority . "</b></td>";
        echo "<td height='25'><b>" . $strProbability . "</b></td>";
        echo "</tr>";
        echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
        // Banners
        foreach (array_keys($rows) as $key) {
            $name = phpAds_getBannerName($rows[$key]['bannerid'], 60, false);
            if ($i > 0) {
                echo "<tr height='1'><td colspan='5' 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 "&nbsp;&nbsp;";
            // Banner icon
            if ($rows[$key]['storagetype'] == 'html') {
                echo "<img src='images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
            } elseif ($rows[$key]['storagetype'] == 'url') {
                echo "<img src='images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
            } else {
                echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
            }
            // Name
            echo $name;
            echo "</td>";
            echo "<td height='25'>" . $rows[$key]['bannerid'] . "</td>";
            echo "<td height='25'>" . $rows[$key]['priority'] . "</td>";
            echo "<td height='25'>" . number_format($rows[$key]['priority'] / $prioritysum * 100, $phpAds_config['percentage_decimals']) . "%</td>";
            echo "</tr>";
            $i++;
        }
        // Footer
        echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
        echo "</table>";
    }
}
    }
    while ($row = phpAds_dbFetchArray($res)) {
        phpAds_PageContext(phpAds_getBannerName($row['bannerid']), "stats-linkedbanner-history.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&bannerid=" . $row['bannerid'], $bannerid == $row['bannerid']);
    }
    phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
    phpAds_PageShortcut($strZoneProperties, 'zone-edit.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-zone.gif');
    phpAds_PageShortcut($strIncludedBanners, 'zone-include.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-zone-linked.gif');
    phpAds_PageHeader("2.4.2.2.1");
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;" . phpAds_getAffiliateName($affiliateid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;" . phpAds_getZoneName($zoneid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone-linked.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . "</b><br><br><br>";
    phpAds_ShowSections(array("2.4.2.2.1"));
} else {
    phpAds_PageHeader("1.1.2.1");
    echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;" . phpAds_getZoneName($zoneid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone-linked.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . "</b><br><br><br>";
    phpAds_ShowSections(array("1.1.2.1"));
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$lib_history_where = "zoneid = " . $zoneid . " AND bannerid = " . $bannerid;
$lib_history_params = array('affiliateid' => $affiliateid, 'zoneid' => $zoneid, 'bannerid' => $bannerid);
include "lib-history.inc.php";
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
 echo "<td height='25' align='" . $phpAds_TextAlignRight . "'><b>" . $GLOBALS['strClicks'] . "</b></td>";
 echo "<td height='25' align='" . $phpAds_TextAlignRight . "'><b>" . $GLOBALS['strCTRShort'] . "</b>&nbsp;&nbsp;</td>";
 echo "</tr>";
 echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
 $i = 0;
 while (list($key, ) = each($linkedbanners)) {
     $linkedbanner = $linkedbanners[$key];
     echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">";
     // Icon & name
     echo "<td height='25'>";
     if (ereg('bannerid:' . $linkedbanner['bannerid'], $zone['what'])) {
         echo "&nbsp;&nbsp;<img src='images/icon-zone-linked.gif' align='absmiddle'>&nbsp;";
     } else {
         echo "&nbsp;&nbsp;<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
     }
     echo "<a href='stats-linkedbanner-history.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&bannerid=" . $linkedbanner['bannerid'] . "'>" . phpAds_getBannerName($linkedbanner['bannerid'], 30, false) . "</a>";
     echo "</td>";
     echo "<td height='25'>" . $linkedbanner['bannerid'] . "</td>";
     echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($linkedbanner['views']) . "</td>";
     echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($linkedbanner['clicks']) . "</td>";
     echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_buildCTR($linkedbanner['views'], $linkedbanner['clicks']) . "&nbsp;&nbsp;</td>";
     echo "</tr>";
     echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
     $i++;
 }
 // Total
 echo "<tr height='25'><td height='25'>&nbsp;&nbsp;<b>" . $strTotal . "</b></td>";
 echo "<td height='25'>&nbsp;</td>";
 echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($totalviews) . "</td>";
 echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($totalclicks) . "</td>";
 echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_buildCTR($totalviews, $totalclicks) . "&nbsp;&nbsp;</td>";
function phpAds_showBanners()
{
    $conf = $GLOBALS['_MAX']['CONF'];
    global $strUntitled, $strName, $strID, $strWeight;
    global $strProbability, $strPriority, $strRecalculatePriority;
    global $phpAds_TextDirection;
    $doAdZoneAssoc = OA_Dal::factoryDO('ad_zone_assoc');
    $doAdZoneAssoc->selectAdd();
    $doAdZoneAssoc->selectAs(array('ad_id'), 'bannerid');
    $doAdZoneAssoc->selectAdd('priority');
    $doAdZoneAssoc->zoneid = 0;
    $doAdZoneAssoc->OrderBy('priority DESC');
    $doAdZoneAssoc->find();
    $rows = array();
    $prioritysum = 0;
    while ($doAdZoneAssoc->fetch() && ($tmprow = $doAdZoneAssoc->toArray())) {
        if ($tmprow['priority']) {
            $prioritysum += $tmprow['priority'];
            $rows[$tmprow['bannerid']] = $tmprow;
        }
    }
    if (is_array($rows)) {
        $i = 0;
        // Header
        echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>";
        echo "<tr height='25'>";
        echo "<td height='25'><b>&nbsp;&nbsp;" . $strName . "</b></td>";
        echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
        echo "<td height='25'><b>" . $strPriority . "</b></td>";
        echo "<td height='25'><b>" . $strProbability . "</b></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>";
        // Banners
        foreach (array_keys($rows) as $key) {
            $name = phpAds_getBannerName($rows[$key]['bannerid'], 60, false);
            if ($i > 0) {
                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 "&nbsp;&nbsp;";
            // Banner icon
            if ($rows[$key]['storagetype'] == 'html') {
                echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
            } elseif ($rows[$key]['storagetype'] == 'url') {
                echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
            } else {
                echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
            }
            // Name
            echo $name;
            echo "</td>";
            echo "<td height='25'>" . $rows[$key]['bannerid'] . "</td>";
            echo "<td height='25'>" . $rows[$key]['priority'] . "</td>";
            echo "<td height='25'>" . number_format($rows[$key]['priority'] / $prioritysum * 100, $pref['ui_percentage_decimals']) . "%</td>";
            echo "</tr>";
            $i++;
        }
        // Footer
        echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
        echo "</table>";
    }
}
    phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
    phpAds_PageShortcut($strZoneProperties, 'zone-edit.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-zone.gif');
    phpAds_PageShortcut($strIncludedBanners, 'zone-include.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-zone-linked.gif');
    phpAds_PageHeader("2.4.2.2.1");
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;" . phpAds_getAffiliateName($affiliateid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;" . phpAds_getZoneName($zoneid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone-linked.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . ($anonymous == 't' ? " - This is a blind campaign!" : "") . "</b><br><br><br>";
    phpAds_ShowSections(array("2.4.2.2.1"));
} else {
    // Get the adviews/clicks for each banner
    $res_anonymous = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tb.bannerid,\n\t\t\t\tb.campaignid,\n\t\t\t\tc.campaignid,\n\t\t\t\tanonymous\n\t\t\tFROM \n\t\t\t\t" . $phpAds_config['tbl_banners'] . " as b,\n\t\t\t\t" . $phpAds_config['tbl_campaigns'] . " as c\n\t\t\tWHERE\n\t\t\t\tb.bannerid = " . $bannerid . " AND\n\t\t\t\tb.campaignid = c.campaignid\n\t\t\t") or phpAds_sqlDie();
    $row_anonymous = phpAds_dbFetchArray($res_anonymous);
    $anonymous = $row_anonymous['anonymous'];
    phpAds_PageHeader("1.1.2.1");
    echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;" . phpAds_getZoneName($zoneid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone-linked.gif' align='absmiddle'>&nbsp;<b>" . ($anonymous == "f" ? phpAds_getBannerName($bannerid) : "(Hidden Banner)") . "</b><br><br><br>";
    phpAds_ShowSections(array("1.1.2.1"));
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$lib_history_where = "zoneid = " . $zoneid . " AND bannerid = " . $bannerid;
$lib_history_params = array('affiliateid' => $affiliateid, 'zoneid' => $zoneid, 'bannerid' => $bannerid);
include "lib-history.inc.php";
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
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'>&nbsp;</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'>&nbsp;" . phpAds_buildZoneName($z['zoneid'], $z['zonename']);
                echo "&nbsp;<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'>&nbsp;<b>" . phpAds_buildZoneName($zone['zoneid'], $zone['zonename']) . "</b></nobr><br>";
            } else {
                echo "<nobr><img src='images/icon-generatecode.gif' align='absmiddle'>&nbsp;<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>&nbsp;&nbsp;" . $strName . "</b></td>";
        echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
        echo "<td height='25'><b>" . $strProbability . "</b></td>";
        echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>&nbsp;</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 "&nbsp;&nbsp;";
            // Banner icon
            if ($rows[$key]['storagetype'] == 'html') {
                echo "<img src='images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
            } elseif ($rows[$key]['storagetype'] == 'txt') {
                echo "<img src='images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
            } elseif ($rows[$key]['storagetype'] == 'url') {
                echo "<img src='images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
            } else {
                echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
            }
            // 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'>&nbsp;" . $strShowBanner . "</a>&nbsp;&nbsp;";
            echo "</td>";
            echo "</tr>";
            $i++;
        }
        if (!$i) {
            echo "<tr height='25' bgcolor='#F6F6F6'>";
            echo "<td colspan='4'>&nbsp;&nbsp;" . $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>";
    }
}
Beispiel #7
0
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%'>&nbsp;&nbsp;<b>" . $strName . "</b></td>";
            echo "<td height='25'><b>" . $strID . "</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
            echo "<td height='25'>&nbsp;</td>";
            echo "<td height='25'>&nbsp;</td>";
            echo "<td height='25'><b>{$strLimitations}</b></td>";
            echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>&nbsp;</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 "&nbsp;&nbsp;";
                // Banner icon
                if ($aLinkedAd['type'] == 'html') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
                } elseif ($aLinkedAd['type'] == 'txt') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
                } elseif ($aLinkedAd['type'] == 'url') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
                } else {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
                }
                // 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'>&nbsp;</td>";
                echo "<td height='25'>&nbsp;</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'>&nbsp;{$linkStart}<strong>{$strNoLimitations}</strong>{$linkEnd}";
                } elseif ($limitations && $capping) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations} &amp; {$strCapping}{$linkEnd}";
                } elseif ($limitations) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations}{$linkEnd}";
                } elseif ($capping) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'>&nbsp;{$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'>&nbsp;";
                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>&nbsp;&nbsp;";
                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>&nbsp;&nbsp;" . $strName . "</b></td>";
            echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 . "'>&nbsp;</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 "&nbsp;&nbsp;";
                    // Banner icon
                    if ($aLinkedAd['type'] == 'html') {
                        echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
                    } elseif ($aLinkedAd['type'] == 'txt') {
                        echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
                    } elseif ($aLinkedAd['type'] == 'url') {
                        echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
                    } else {
                        echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
                    }
                    // 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'>&nbsp;{$linkStart}{$strNoLimitations}{$linkEnd}";
                    } elseif ($limitations && $capping) {
                        echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations} &amp; {$strCapping}{$linkEnd}";
                    } elseif ($limitations) {
                        echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations}{$linkEnd}";
                    } elseif ($capping) {
                        echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'>&nbsp;{$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'>&nbsp;";
                    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>&nbsp;&nbsp;";
                    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>&nbsp;&nbsp;" . $strName . "</b></td>";
            echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 . "'>&nbsp;</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 "&nbsp;&nbsp;";
                // Banner icon
                if ($aLinkedAd['type'] == 'html') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
                } elseif ($aLinkedAd['type'] == 'txt') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
                } elseif ($aLinkedAd['type'] == 'url') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
                } else {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
                }
                // 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'>&nbsp;{$linkStart}{$strNoLimitations}{$linkEnd}";
                } elseif ($limitations && $capping) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations} &amp; {$strCapping}{$linkEnd}";
                } elseif ($limitations) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations}{$linkEnd}";
                } elseif ($capping) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'>&nbsp;{$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'>&nbsp;";
                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>&nbsp;&nbsp;";
                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>&nbsp;&nbsp;" . $strName . "</b></td>";
            echo "<td height='25'><b>" . $strID . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 . "'>&nbsp;</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 "&nbsp;&nbsp;";
                // Banner icon
                if ($aLinkedAd['type'] == 'html') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
                } elseif ($aLinkedAd['type'] == 'txt') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
                } elseif ($aLinkedAd['type'] == 'url') {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
                } else {
                    echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
                }
                // 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'>&nbsp;{$linkStart}{$strNoLimitations}{$linkEnd}";
                } elseif ($limitations && $capping) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations} &amp; {$strCapping}{$linkEnd}";
                } elseif ($limitations) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Limitations' align='middle' border='0'>&nbsp;{$linkStart}{$strLimitations}{$linkEnd}";
                } elseif ($capping) {
                    echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' alt='Capping' align='middle' border='0'>&nbsp;{$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'>&nbsp;";
                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>&nbsp;&nbsp;";
                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 />";
    }
}
    phpAds_PageShortcut($strModifyBannerAcl, 'banner-acl.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-acl.gif');
    phpAds_PageHeader("2.1.2.2.1.2");
    echo "<img src='images/icon-client.gif' align='absmiddle'>&nbsp;" . phpAds_getParentName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getClientName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;" . phpAds_getBannerName($bannerid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-date.gif' align='absmiddle'>&nbsp;<b>" . date(str_replace('%', '', $date_format), mktime(0, 0, 0, substr($day, 4, 2), substr($day, 6, 2), substr($day, 0, 4))) . "</b><br><br>";
    echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>";
    phpAds_ShowSections(array("2.1.2.2.1.1", "2.1.2.2.1.2"));
}
if (phpAds_isUser(phpAds_Client)) {
    phpAds_PageHeader("1.2.2.1.2");
    echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getClientName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;" . phpAds_getBannerName($bannerid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-date.gif' align='absmiddle'>&nbsp;<b>" . date(str_replace('%', '', $date_format), mktime(0, 0, 0, substr($day, 4, 2), substr($day, 6, 2), substr($day, 0, 4))) . "</b><br><br>";
    echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>";
    phpAds_ShowSections(array("1.2.2.1.1", "1.2.2.1.2"));
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$lib_hourly_where = "bannerid = " . $bannerid;
include "lib-hourly-hosts.inc.php";
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
Beispiel #9
0
    if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif');
        phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-campaign.gif');
        phpAds_PageShortcut($strBannerHistory, 'stats.php?entity=banner&breakdown=history&clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-statistics.gif');
        phpAds_PageHeader("4.1.3.4.5");
        echo "<img src='" . OX::assetPath() . "/images/icon-advertiser.gif' align='absmiddle'>&nbsp;" . phpAds_getParentClientName($campaignid);
        echo "&nbsp;<img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='" . OX::assetPath() . "/images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getCampaignName($campaignid);
        echo "&nbsp;<img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . "</b><br /><br />";
        phpAds_ShowSections(array("4.1.3.4.5"));
    } else {
        phpAds_PageHeader("1.2.2.3");
        echo "<img src='" . OX::assetPath() . "/images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getCampaignName($campaignid);
        echo "&nbsp;<img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='" . OX::assetPath() . "/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . "</b><br /><br />";
        phpAds_ShowSections(array("1.2.2.3"));
    }
    $doBanners = OA_Dal::factoryDO('banners');
    $doBanners->get($bannerid);
    $row = $doBanners->toArray();
    if ($row['contenttype'] == 'swf') {
        if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') {
            $swf_file = phpAds_ImageRetrieve($row['storagetype'], $row['filename']);
        }
    } else {
        // Banner is not a flash banner, return to banner-edit.php
        header("Location: banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $bannerid);
        exit;
    }
} else {
function rowPresenter($array, $i = 0, $level = 0, $parent = '', $isClient = false, $id = 0)
{
    global $HTTP_SERVER_VARS, $phpAds_TextAlignRight, $phpAds_TextDirection, $hideinactive, $i;
    if (is_array($array)) {
        foreach ($array as $array) {
            if ($array['kind'] == 'campaign' && $array['active'] == 'f' && $hideinactive == '1') {
                continue;
            }
            // Define kind of row and id
            $kind = $array['kind'];
            $thisID = $array['id'];
            // Inserts divider if NOT top level (level > 0)
            if ($level > 0) {
                echo "<tr " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "height='1'><td><img src='images/spacer.gif' width='1' height='1'></td><td colspan='6' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
            }
            // Sets background color of the row
            echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">";
            // Indents as necesseary
            echo "<td height='25'>";
            echo "<img src='images/spacer.gif' height='16' width='" . 4 . "'>";
            echo "<img src='images/spacer.gif' height='16' width='" . $level * 20 . "'>";
            // expanding arrows
            if (isset($array['children']) && ($array['anonymous'] == 'f' || !phpAds_isUser(phpAds_Affiliate) && !phpAds_isUser(phpAds_Client))) {
                if (isset($array['expand']) && $array['expand'] == '1') {
                    echo "<a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?_id_=" . ($parent != '' ? $parent . "-" : '') . $thisID . "&collapse=1&" . ($isClient ? 'clientid=' . $id : 'affiliateid=' . $id) . "'><img src='images/triangle-d.gif' align='absmiddle' align='absmiddle' border='0'></a>";
                } else {
                    echo "<a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?_id_=" . ($parent != '' ? $parent . "-" : '') . $thisID . "&expand=1&" . ($isClient ? 'clientid=' . $id : 'affiliateid=' . $id) . "'><img src='images/" . $phpAds_TextDirection . "/triangle-l.gif' align='absmiddle' border='0'></a>";
                }
            } else {
                echo "<img src='images/spacer.gif' height='16' width='" . 16 . "' align='absmiddle'>";
            }
            echo "<img src='images/spacer.gif' height='16' width='" . 4 . "'>";
            // specific zone stuff
            if ($kind == 'zone') {
                // icon
                if ($array['delivery'] == phpAds_ZoneBanner) {
                    echo "<img src='images/icon-zone.gif' align='absmiddle'>";
                } elseif ($array['delivery'] == phpAds_ZoneInterstitial) {
                    echo "<img src='images/icon-interstitial.gif' align='absmiddle'>";
                } elseif ($array['delivery'] == phpAds_ZonePopup) {
                    echo "<img src='images/icon-popup.gif' align='absmiddle'>";
                } elseif ($array['delivery'] == phpAds_ZoneText) {
                    echo "<img src='images/icon-textzone.gif' align='absmiddle'>";
                }
                // spacer between icon and name
                echo "<img src='images/spacer.gif' height='16' width='" . 4 . "' align='absmiddle'>";
                // name and info
                echo "<a href='stats-zone-history.php?affiliateid=" . $array['affiliateid'] . "&zoneid=" . $array['id'] . "'>" . $array['name'] . "</a>";
                echo "</td>";
                echo "<td height='25'>" . $array['id'] . "</td>";
            } else {
                if ($kind == 'campaign') {
                    // check whether the campaign is active
                    if ($array['active'] == 't') {
                        echo "<img src='images/icon-campaign.gif' align='absmiddle'>";
                    } else {
                        echo "<img src='images/icon-campaign-d.gif' align='absmiddle'>";
                    }
                    // spacer between icon and name
                    echo "<img src='images/spacer.gif' height='16' width='" . 4 . "' align='absmiddle'>";
                    // get campaign name
                    $name = '';
                    if (isset($array['alt']) && $array['alt'] != '') {
                        $name = $array['alt'];
                    }
                    if (isset($array['name']) && $array['name'] != '') {
                        $name = $array['name'];
                    }
                    // check whether we should show the name and id of this banner
                    if ($array['anonymous'] == 't' && (phpAds_isUser(phpAds_Affiliate) || phpAds_isUser(phpAds_Client))) {
                        echo "<a href='#'>" . $GLOBALS['strHiddenCampaign'] . "</a></td>";
                        echo "<td height='25'></td>";
                    } else {
                        echo $isClient ? "<a href='stats-campaign-history.php?clientid=" . $id . "&campaignid=" . $array['id'] . "'>" . $name . "</a>" : "<a href='stats-campaign-affiliates.php?clientid=" . $id . "&campaignid=" . $array['id'] . "'>" . $name . "</a>";
                        echo "</td><td height='25'>" . $array['id'] . "</td>";
                    }
                } else {
                    if ($kind == 'banner') {
                        if (ereg('bannerid:' . $array['id'], $array['what'])) {
                            echo "<img src='images/icon-zone-linked.gif' align='absmiddle'>";
                        } else {
                            echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>";
                        }
                        // spacer between icon and name
                        echo "<img src='images/spacer.gif' height='16' width='" . 4 . "' align='absmiddle'>";
                        if ($isClient) {
                            echo "<a href='stats-banner-history.php?clientid=" . $id . "&bannerid=" . $array['id'] . "&campaignid=" . phpAds_getBannerParentClientID($array['id']) . "'>" . ($array['anonymous'] == 't' ? "(Hidden Banner)" : phpAds_getBannerName($array['id'], 30, false)) . "</td>";
                        } else {
                            $thiszone = explode('-', $parent);
                            echo "<a href='stats-linkedbanner-history.php?affiliateid=" . $id . "&zoneid=" . $thiszone[0] . "&bannerid=" . $array['id'] . "'>" . ($array['anonymous'] == 't' ? "(Hidden Banner)" : phpAds_getBannerName($array['id'], 30, false)) . "</td>";
                        }
                        echo "</td>";
                        echo "<td height='25'>" . $array['id'] . "</td>";
                    }
                }
            }
            echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($array['views']) . "</td>";
            echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($array['clicks']) . "</td>";
            echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_buildCTR($array['views'], $array['clicks']) . "</td>";
            echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($array['conversions']) . "</td>";
            echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_buildCTR($array['clicks'], $array['conversions']) . "&nbsp;&nbsp;</td>";
            echo "</tr>";
            if ($array['expand'] == TRUE && ($array['anonymous'] != 't' || !phpAds_isUser(phpAds_Affiliate) && !phpAds_isUser(phpAds_Client)) && is_array($array['children'])) {
                rowPresenter($array['children'], $i, $level + 1, ($parent != '' ? $parent . "-" : '') . $thisID, $isClient, $id);
            }
            if ($level == 0) {
                echo "<tr height='1'><td colspan='7' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
            }
            if ($level == 0) {
                $i++;
            }
        }
    }
}
         while (list($bkey, ) = each($banners)) {
             // Divider
             echo "<tr height='1'>";
             echo "<td " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><img src='images/spacer.gif' width='1' height='1'></td>";
             echo "<td colspan='5' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td>";
             echo "</tr>";
             // Icon & name
             echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><td height='25'>";
             echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
             echo "<img src='images/spacer.gif' height='16' width='16'>&nbsp;";
             if (ereg('bannerid:' . $banners[$bkey]['bannerid'], $zone['what'])) {
                 echo "<img src='images/icon-zone-linked.gif' align='absmiddle'>&nbsp;";
             } else {
                 echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
             }
             echo "<a href='stats-linkedbanner-history.php?affiliateid=" . $zone['affiliateid'] . "&zoneid=" . $zone['zoneid'] . "&bannerid=" . $banners[$bkey]['bannerid'] . "'>" . phpAds_getBannerName($banners[$bkey]['bannerid'], 30, false) . "</td>";
             echo "</td>";
             echo "<td height='25'>" . $banners[$bkey]['bannerid'] . "</td>";
             echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($banners[$bkey]['views']) . "</td>";
             echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($banners[$bkey]['clicks']) . "</td>";
             echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_buildCTR($banners[$bkey]['views'], $banners[$bkey]['clicks']) . "&nbsp;&nbsp;</td>";
             echo "</tr>";
         }
     }
     echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
     $i++;
 }
 // Total
 echo "<tr height='25'><td height='25'>&nbsp;&nbsp;<b>" . $strTotal . "</b></td>";
 echo "<td height='25'>&nbsp;</td>";
 echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>" . phpAds_formatNumber($totalviews) . "</td>";