} } if (!isset($period_range)) { if (isset($Session['prefs']['stats-zone-linkedbanners.php']['period_range'])) { $period_range = $Session['prefs']['stats-zone-linkedbanners.php']['period_range']; } else { $period_range = array('start_day' => 0, 'start_month' => 0, 'start_year' => 0, 'end_day' => 0, 'end_month' => 0, 'end_year' => 0); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\taffiliateid = '" . $affiliateid . "'\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildZoneName($row['zoneid'], $row['zonename']), "stats-zone-linkedbanners.php?affiliateid=" . $affiliateid . "&zoneid=" . $row['zoneid'], $zoneid == $row['zoneid']); } 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"); echo "<img src='images/icon-affiliate.gif' align='absmiddle'> " . phpAds_getAffiliateName($affiliateid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-zone.gif' align='absmiddle'> <b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.4.2.1", "2.4.2.2")); } else { phpAds_PageHeader("1.1.2"); echo "<img src='images/icon-zone.gif' align='absmiddle'> <b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>"; phpAds_ShowSections(array("1.1.1", "1.1.2")); } /*********************************************************/
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>"; } }
// Get list of public publishers if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE publiczones = 't'" . " OR affiliateid=" . $affiliateid; } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE (publiczones = 't'" . " OR affiliateid=" . $affiliateid . ")" . " AND agencyid=" . phpAds_getUserID(); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { $available[] = "affiliateid = '" . $row['affiliateid'] . "'"; } $available = implode($available, ' OR '); // Get list of zones to link to $res = phpAds_dbQuery("SELECT zoneid, zonename, delivery FROM " . $phpAds_config['tbl_zones'] . " WHERE " . "(delivery = " . phpAds_ZonePopup . " OR delivery = " . phpAds_ZoneInterstitial . ") AND (" . $available . ") ORDER BY zoneid"); $available = array(phpAds_ZonePopup => array(), phpAds_ZoneInterstitial => array()); while ($row = phpAds_dbFetchArray($res)) { $available[$row['delivery']][$row['zoneid']] = phpAds_buildZoneName($row['zoneid'], $row['zonename']); } // Determine appendtype if (isset($appendtype)) { $zone['appendtype'] = $appendtype; } // Appendtype choices echo "<tr><td width='30'> </td><td width='200' valign='top'>" . $GLOBALS['strZoneAppendType'] . "</td><td>"; echo "<select name='appendtype' style='width: 200;' onchange='phpAds_formSelectAppendType()' tabindex='" . $tabindex++ . "'>"; echo "<option value='" . phpAds_ZoneAppendRaw . "'" . ($zone['appendtype'] == phpAds_ZoneAppendRaw ? ' selected' : '') . ">" . $GLOBALS['strZoneAppendHTMLCode'] . "</option>"; if (count($available[phpAds_ZonePopup]) || count($available[phpAds_ZoneInterstitial])) { echo "<option value='" . phpAds_ZoneAppendZone . "'" . ($zone['appendtype'] == phpAds_ZoneAppendZone ? ' selected' : '') . ">" . $GLOBALS['strZoneAppendZoneSelection'] . "</option>"; } else { $zone['appendtype'] = phpAds_ZoneAppendRaw; } echo "</select></td></tr>";
/*********************************************************/ if ($zoneid != "") { if (isset($Session['prefs']['affiliate-zones.php']['listorder'])) { $navorder = $Session['prefs']['affiliate-zones.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['affiliate-zones.php']['orderdirection'])) { $navdirection = $Session['prefs']['affiliate-zones.php']['orderdirection']; } else { $navdirection = ''; } // Get other zones $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\taffiliateid = '" . $affiliateid . "'\n\t\t\t" . phpAds_getZoneListOrder($navorder, $navdirection) . "\n\t"); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildZoneName($row['zoneid'], $row['zonename']), "zone-edit.php?affiliateid=" . $affiliateid . "&zoneid=" . $row['zoneid'], $zoneid == $row['zoneid']); } if (phpAds_isUser(phpAds_Admin)) { phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif'); phpAds_PageShortcut($strZoneHistory, 'stats-zone-history.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-statistics.gif'); $extra = "<form action='zone-modify.php'>"; $extra .= "<input type='hidden' name='zoneid' value='{$zoneid}'>"; $extra .= "<input type='hidden' name='affiliateid' value='{$affiliateid}'>"; $extra .= "<input type='hidden' name='returnurl' value='zone-edit.php'>"; $extra .= "<br><br>"; $extra .= "<b>{$strModifyZone}</b><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-duplicate-zone.gif' align='absmiddle'> <a href='zone-modify.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&duplicate=true&returnurl=zone-edit.php'>{$strDuplicate}</a><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-move-zone.gif' align='absmiddle'> {$strMoveTo}<br>"; $extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>";