function Plugin_GlobalhistoryExecute($delimiter = ",")
{
    global $phpAds_config, $date_format;
    global $strGlobalHistory, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort;
    header("Content-type: application/csv\nContent-Disposition: \"inline; filename=globalhistory.csv\"");
    if (phpAds_isUser(phpAds_Admin)) {
        $res_query = "\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '" . $date_format . "') as day,\n\t\t\tSUM(views) AS adviews,\n\t\t\tSUM(clicks) AS adclicks\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tGROUP BY\n\t\t\tday\n\t";
    } else {
        $res_query = "SELECT\n\t\t\t\t\t\tDATE_FORMAT(s.day, '" . $date_format . "') as day,\n\t\t\t\t\t\tSUM(s.views) AS adviews,\n\t\t\t\t\t\tSUM(s.clicks) AS adclicks\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $phpAds_config['tbl_adstats'] . " \tas s,\n\t\t\t\t\t\t" . $phpAds_config['tbl_banners'] . " \tas b,\n\t\t\t\t\t\t" . $phpAds_config['tbl_campaigns'] . " as m,\n\t\t\t\t\t\t" . $phpAds_config['tbl_clients'] . " \tas c\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ts.bannerid \t\t= b.bannerid AND\n\t\t\t\t\t\tb.campaignid \t= m.campaignid AND\n\t\t\t\t\t\tm.clientid \t\t= c.clientid AND\n\t\t\t\t\t\tc.agencyid \t\t= " . phpAds_getUserID() . "\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tday";
    }
    $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie();
    while ($row_banners = phpAds_dbFetchArray($res_banners)) {
        $stats[$row_banners['day']]['views'] = $row_banners['adviews'];
        $stats[$row_banners['day']]['clicks'] = $row_banners['adclicks'];
    }
    echo $strGlobalHistory . "\n\n";
    echo $strDay . $delimiter . $strViews . $delimiter . $strClicks . $delimiter . $strCTRShort . "\n";
    $totalclicks = 0;
    $totalviews = 0;
    if (isset($stats) && is_array($stats)) {
        for (reset($stats); $key = key($stats); next($stats)) {
            $row = array();
            //$key = implode('/',array_reverse(split('[-]',$key)));
            $row[] = $key;
            $row[] = $stats[$key]['views'];
            $row[] = $stats[$key]['clicks'];
            $row[] = phpAds_buildCTR($stats[$key]['views'], $stats[$key]['clicks']);
            echo implode($delimiter, $row) . "\n";
            $totalclicks += $stats[$key]['clicks'];
            $totalviews += $stats[$key]['views'];
        }
    }
    echo "\n";
    echo $strTotal . $delimiter . $totalviews . $delimiter . $totalclicks . $delimiter . phpAds_buildCTR($totalviews, $totalclicks) . "\n";
}
Пример #2
0
function phpAds_getZoneArray()
{
    global $phpAds_config;
    if (phpAds_isUser(phpAds_Affiliate)) {
        $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\tWHERE\n\t\t\t\taffiliateid = " . phpAds_getUserID() . "\n\t\t");
    } else {
        $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t");
    }
    while ($row = phpAds_dbFetchArray($res)) {
        $zoneArray[$row['zoneid']] = phpAds_buildClientName($row['zoneid'], $row['zonename']);
    }
    return $zoneArray;
}
Пример #3
0
function phpAds_SettingsWriteFlush()
{
    global $phpAds_config;
    global $phpAds_settings_information, $phpAds_settings_write_cache;
    $sql = array();
    $config_inc = array();
    while (list($k, $v) = each($phpAds_settings_write_cache)) {
        $k_sql = $phpAds_settings_information[$k]['sql'];
        $k_type = $phpAds_settings_information[$k]['type'];
        if ($k_sql) {
            if ($k_type == 'boolean') {
                $v = $v ? 't' : 'f';
            }
            $sql[] = $k . " = '" . $v . "'";
        } else {
            if ($k_type == 'boolean') {
                $v = $v ? true : false;
            } elseif ($k_type != 'array') {
                $v = stripslashes($v);
            }
            $config_inc[] = array($k, $v, $k_type);
        }
    }
    if (count($sql)) {
        if (phpAds_isUser(phpAds_Agency)) {
            $agencyid = phpAds_getUserID();
        } else {
            $agencyid = 0;
        }
        $query = "UPDATE " . $phpAds_config['tbl_config'] . " SET " . join(", ", $sql) . " WHERE agencyid=" . $agencyid;
        $res = @phpAds_dbQuery($query);
        if (@phpAds_dbAffectedRows() < 1) {
            $query = "INSERT INTO " . $phpAds_config['tbl_config'] . " SET " . join(", ", $sql) . ",agencyid=" . $agencyid;
            @phpAds_dbQuery($query);
        }
    }
    if (count($config_inc)) {
        if (!phpAds_ConfigFilePrepare()) {
            return false;
        }
        while (list(, $v) = each($config_inc)) {
            phpAds_ConfigFileSet($v[0], $v[1], $v[2]);
        }
        return phpAds_ConfigFileFlush();
    }
    return true;
}
function phpAds_SettingsSelection($section)
{
    global $phpAds_TextDirection, $strHelp;
    global $tabindex;
    if (!isset($tabindex)) {
        $tabindex = 1;
    }
    ?>
<script language="JavaScript">
<!--
function settings_goto_section()
{
	s = document.settings_selection.section.selectedIndex;

	s = document.settings_selection.section.options[s].value;
	document.location = 'settings-' + s + '.php';
}
// -->
</script>

<?php 
    echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
    echo "<tr><form name='settings_selection'><td height='35'><b>";
    echo $GLOBALS['strChooseSection'] . ":&nbsp;</b>";
    echo "<select name='section' onChange='settings_goto_section();' tabindex='" . $tabindex++ . "'>";
    if (phpAds_isUser(phpAds_Admin)) {
        echo "<option value='db'" . ($section == 'db' ? ' selected' : '') . ">" . $GLOBALS['strDatabaseSettings'] . "</option>";
    }
    echo "<option value='invocation'" . ($section == 'invocation' ? ' selected' : '') . ">" . $GLOBALS['strInvocationAndDelivery'] . "</option>";
    echo "<option value='host'" . ($section == 'host' ? ' selected' : '') . ">" . $GLOBALS['strHostAndGeo'] . "</option>";
    echo "<option value='stats'" . ($section == 'stats' ? ' selected' : '') . ">" . $GLOBALS['strStatisticsSettings'] . "</option>";
    echo "<option value='banner'" . ($section == 'banner' ? ' selected' : '') . ">" . $GLOBALS['strBannerSettings'] . "</option>";
    if (phpAds_isUser(phpAds_Admin)) {
        echo "<option value='admin'" . ($section == 'admin' ? ' selected' : '') . ">" . $GLOBALS['strAdministratorSettings'] . "</option>";
    }
    echo "<option value='interface'" . ($section == 'interface' ? ' selected' : '') . ">" . $GLOBALS['strGuiSettings'] . "</option>";
    echo "<option value='defaults'" . ($section == 'defaults' ? ' selected' : '') . ">" . $GLOBALS['strInterfaceDefaults'] . "</option>";
    echo "</select>&nbsp;<a href='javascript:void(0)' onClick='settings_goto_section();'>";
    echo "<img src='images/" . $phpAds_TextDirection . "/go_blue.gif' border='0'></a>";
    echo "</td></form>";
    echo "<td height='35' align='right'><b><a href=\"#\" onClick=\"javascript:toggleHelp(); return false;\">";
    echo "<img src='images/help-book.gif' width='15' height='15' border='0' align='absmiddle'>";
    echo "&nbsp;" . $strHelp . "</a></b></td></tr></table>";
    phpAds_ShowBreak();
}
Пример #5
0
    header("Location: upgrade.php");
    exit;
}
// Check for SLL requirements
if ($phpAds_config['ui_forcessl'] && $_SERVER['SERVER_PORT'] != 443) {
    header('Location: https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']);
    exit;
}
// Adjust url_prefix if SLL is used
if ($_SERVER['SERVER_PORT'] == 443) {
    $phpAds_config['url_prefix'] = str_replace('http://', 'https://', $phpAds_config['url_prefix']);
}
// First thing to do is clear the $Session variable to
// prevent users from pretending to be logged in.
unset($Session);
// Authorize the user
phpAds_Start();
// Load language strings
@(include phpAds_path . '/language/english/default.lang.php');
if ($phpAds_config['language'] != 'english' && file_exists(phpAds_path . '/language/' . $phpAds_config['language'] . '/default.lang.php')) {
    @(include phpAds_path . '/language/' . $phpAds_config['language'] . '/default.lang.php');
}
// Register variables
phpAds_registerGlobal('bannerid', 'campaignid', 'clientid', 'zoneid', 'affiliateid', 'userlogid', 'day');
// Check for missing required parameters
phpAds_checkIds();
// Setup navigation
$phpAds_nav = array("admin" => array("2" => array("stats-global-client.php" => $strStats), "2.1" => array("stats-global-client.php" => $strClientsAndCampaigns), "2.1.1" => array("stats-client-history.php?clientid={$clientid}" => $strClientHistory), "2.1.1.1" => array("stats-client-daily.php?clientid={$clientid}&day={$day}" => $strDailyStats), "2.1.1.2" => array("stats-client-daily-hosts.php?clientid={$clientid}&day={$day}" => $strHosts), "2.1.2" => array("stats-client-campaigns.php?clientid={$clientid}" => $strCampaignOverview), "2.1.2.1" => array("stats-campaign-history.php?clientid={$clientid}&campaignid={$campaignid}" => $strCampaignHistory), "2.1.2.1.1" => array("stats-campaign-daily.php?clientid={$clientid}&campaignid={$campaignid}&day={$day}" => $strDailyStats), "2.1.2.1.2" => array("stats-campaign-daily-hosts.php?clientid={$clientid}&campaignid={$campaignid}&day={$day}" => $strHosts), "2.1.2.2" => array("stats-campaign-banners.php?clientid={$clientid}&campaignid={$campaignid}" => $strBannerOverview), "2.1.2.2.1" => array("stats-banner-history.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strBannerHistory), "2.1.2.2.1.1" => array("stats-banner-daily.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}&day={$day}" => $strDailyStats), "2.1.2.2.1.2" => array("stats-banner-daily-hosts.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}&day={$day}" => $strHosts), "2.1.2.2.2" => array("stats-banner-affiliates.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strDistribution), "2.1.2.3" => array("stats-campaign-target.php?clientid={$clientid}&campaignid={$campaignid}" => $strTargetStats), "2.2" => array("stats-global-history.php" => $strGlobalHistory), "2.2.1" => array("stats-global-daily.php?day={$day}" => $strDailyStats), "2.2.2" => array("stats-global-daily-hosts.php?day={$day}" => $strHosts), "2.4" => array("stats-global-affiliates.php" => $strAffiliatesAndZones), "2.4.1" => array("stats-affiliate-history.php?affiliateid={$affiliateid}" => $strAffiliateHistory), "2.4.1.1" => array("stats-affiliate-daily.php?affiliateid={$affiliateid}&day={$day}" => $strDailyStats), "2.4.1.2" => array("stats-affiliate-daily-hosts.php?affiliateid={$affiliateid}&day={$day}" => $strHosts), "2.4.2" => array("stats-affiliate-zones.php?affiliateid={$affiliateid}" => $strZoneOverview), "2.4.2.1" => array("stats-zone-history.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strZoneHistory), "2.4.2.1.1" => array("stats-zone-daily.php?affiliateid={$affiliateid}&zoneid={$zoneid}&day={$day}" => $strDailyStats), "2.4.2.1.2" => array("stats-zone-daily-hosts.php?affiliateid={$affiliateid}&zoneid={$zoneid}&day={$day}" => $strHosts), "2.4.2.2" => array("stats-zone-linkedbanners.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strLinkedBannersOverview), "2.4.2.2.1" => array("stats-linkedbanner-history.php?affiliateid={$affiliateid}&zoneid={$zoneid}&bannerid={$bannerid}" => $strLinkedBannerHistory), "2.5" => array("stats-global-misc.php" => $strMiscellaneous), "3" => array("report-index.php" => $strReports), "4" => array("client-index.php" => $strAdminstration), "4.1" => array("client-index.php" => $strClientsAndCampaigns), "4.1.1" => array("client-edit.php" => $strAddClient), "4.1.2" => array("client-edit.php?clientid={$clientid}" => $strClientProperties), "4.1.3" => array("client-campaigns.php?clientid={$clientid}" => $strCampaignOverview), "4.1.3.1" => array("campaign-edit.php?clientid={$clientid}" => $strAddCampaign), "4.1.3.2" => array("campaign-edit.php?clientid={$clientid}&campaignid={$campaignid}" => $strCampaignProperties), "4.1.3.3" => array("campaign-zone.php?clientid={$clientid}&campaignid={$campaignid}" => $strLinkedZones), "4.1.3.4" => array("campaign-banners.php?clientid={$clientid}&campaignid={$campaignid}" => $strBannerOverview), "4.1.3.4.1" => array("banner-edit.php?clientid={$clientid}&campaignid={$campaignid}" => $strAddBanner), "4.1.3.4.2" => array("banner-edit.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strBannerProperties), "4.1.3.4.3" => array("banner-acl.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strModifyBannerAcl), "4.1.3.4.4" => array("banner-zone.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strLinkedZones), "4.1.3.4.5" => array("banner-swf.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strConvertSWFLinks), "4.1.3.4.6" => array("banner-append.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strAppendOthers), "4.2" => array("affiliate-index.php" => $strAffiliatesAndZones), "4.2.1" => array("affiliate-edit.php" => $strAddNewAffiliate), "4.2.2" => array("affiliate-edit.php?affiliateid={$affiliateid}" => $strAffiliateProperties), "4.2.3" => array("affiliate-zones.php?affiliateid={$affiliateid}" => $strZoneOverview), "4.2.3.1" => array("zone-edit.php?affiliateid={$affiliateid}" => $strAddNewZone), "4.2.3.2" => array("zone-edit.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strZoneProperties), "4.2.3.3" => array("zone-include.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strIncludedBanners), "4.2.3.4" => array("zone-probability.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strProbability), "4.2.3.5" => array("zone-invocation.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strInvocationcode), "4.2.3.6" => array("zone-advanced.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strAdvanced), "4.3" => array("admin-generate.php" => $strGenerateBannercode), "5" => array("settings-index.php" => $strSettings), "5.1" => array("settings-db.php" => $strMainSettings), "5.3" => array("maintenance-index.php" => $strMaintenance), "5.2" => array("userlog-index.php" => $strUserLog), "5.2.1" => array("userlog-details.php?userlogid={$userlogid}" => $strUserLogDetails), "5.4" => array("maintenance-updates.php" => $strProductUpdates)), "client" => array("1" => array("stats-client-history.php?clientid={$clientid}" => $strHome), "1.1" => array("stats-client-history.php?clientid={$clientid}" => $strClientHistory), "1.1.1" => array("stats-client-daily.php?clientid={$clientid}&day={$day}" => $strDailyStats), "1.1.2" => array("stats-client-daily-hosts.php?clientid={$clientid}&day={$day}" => $strHosts), "1.2" => array("stats-client-campaigns.php?clientid={$clientid}" => $strCampaignOverview), "1.2.1" => array("stats-campaign-history.php?clientid={$clientid}&campaignid={$campaignid}" => $strCampaignHistory), "1.2.1.1" => array("stats-campaign-daily.php?clientid={$clientid}&campaignid={$campaignid}&day={$day}" => $strDailyStats), "1.2.1.2" => array("stats-campaign-daily-hosts.php?clientid={$clientid}&campaignid={$campaignid}&day={$day}" => $strHosts), "1.2.2" => array("stats-campaign-banners.php?clientid={$clientid}&campaignid={$campaignid}" => $strBannerOverview), "1.2.2.1" => array("stats-banner-history.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strBannerHistory), "1.2.2.1.1" => array("stats-banner-daily.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}&day={$day}" => $strDailyStats), "1.2.2.1.2" => array("stats-banner-daily-hosts.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}&day={$day}" => $strHosts), "1.2.2.2" => array("banner-edit.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strBannerProperties), "1.2.2.3" => array("banner-swf.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}" => $strConvertSWFLinks), "1.2.3" => array("stats-campaign-target.php?clientid={$clientid}&campaignid={$campaignid}" => $strTargetStats), "3" => array("report-index.php" => $strReports)), "affiliate" => array("1" => array("stats-affiliate-zones.php?affiliateid={$affiliateid}" => $strHome), "1.1" => array("stats-affiliate-zones.php?affiliateid={$affiliateid}" => $strZones), "1.1.1" => array("stats-zone-history.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strZoneHistory), "1.1.1.1" => array("stats-zone-daily.php?affiliateid={$affiliateid}&zoneid={$zoneid}&day={$day}" => $strDailyStats), "1.1.1.2" => array("stats-zone-daily-hosts.php?affiliateid={$affiliateid}&zoneid={$zoneid}&day={$day}" => $strHosts), "1.1.2" => array("stats-zone-linkedbanners.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strLinkedBannersOverview), "1.1.2.1" => array("stats-linkedbanner-history.php?affiliateid={$affiliateid}&zoneid={$zoneid}&bannerid={$bannerid}" => $strLinkedBannerHistory), "1.2" => array("stats-affiliate-history.php?affiliateid={$affiliateid}" => $strAffiliateHistory), "1.2.1" => array("stats-affiliate-daily.php?affiliateid={$affiliateid}&day={$day}" => $strDailyStats), "1.2.2" => array("stats-affiliate-daily-hosts.php?affiliateid={$affiliateid}&day={$day}" => $strHosts), "3" => array("report-index.php" => $strReports), "2" => array("affiliate-zones.php?affiliateid={$affiliateid}" => $strAdminstration), "2.1" => array("affiliate-zones.php?affiliateid={$affiliateid}" => $strZones), "2.1.1" => array("zone-edit.php?affiliateid={$affiliateid}&zoneid=0" => $strAddZone), "2.1.2" => array("zone-edit.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strModifyZone), "2.1.3" => array("zone-include.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strIncludedBanners), "2.1.4" => array("zone-probability.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strProbability), "2.1.5" => array("zone-invocation.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strInvocationcode), "2.1.6" => array("zone-advanced.php?affiliateid={$affiliateid}&zoneid={$zoneid}" => $strChains), "2.2" => array("affiliate-edit.php?affiliateid={$affiliateid}" => $strPreferences)));
if (phpAds_isUser(phpAds_Client) && phpAds_isAllowed(phpAds_ModifyInfo)) {
    $phpAds_nav["client"]["2"] = array("client-edit.php" => $strPreferences);
}
        echo $row_trackers['trackername'];
    }
    //	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    echo "</td>\n";
    // ID
    echo "\t\t\t\t\t<td height='25'>" . $row_trackers['trackerid'] . "</td>\n";
    // Button 1, 2 & 3
    echo "\t\t\t\t\t<td height='25'>";
    if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency) || phpAds_isAllowed(phpAds_LinkCampaigns)) {
        echo "<a href='tracker-campaigns.php?clientid=" . $clientid . "&trackerid=" . $row_trackers['trackerid'] . "'><img src='images/icon-zone-linked.gif' border='0' align='absmiddle'>&nbsp;{$strLinkedCampaigns}</a>";
    } else {
        echo "&nbsp;";
    }
    echo "</td>\n";
    echo "\t\t\t\t\t<td height='25'>";
    if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency) || phpAds_isAllowed(phpAds_DeleteTracker)) {
        echo "<a href='tracker-delete.php?clientid=" . $clientid . "&trackerid=" . $row_trackers['trackerid'] . "&returnurl=advertiser-trackers.php'" . phpAds_DelConfirm($strConfirmDeleteTracker) . "><img src='images/icon-recycle.gif' border='0' align='absmiddle' alt='{$strDelete}'>&nbsp;{$strDelete}</a>";
    } else {
        echo "&nbsp;";
    }
    echo "</td>\n";
    echo "\t\t\t\t</tr>\n";
    $i++;
}
if (phpAds_dbNumRows($res_trackers) > 0) {
    //	echo "\t\t\t\t<tr height='1'>\n";
    //	echo "\t\t\t\t\t<td colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td>\n";
    //	echo "\t\t\t\t</tr>\n";
    //}
    //if (isset($campaigns) && count($campaigns))
    //{
function phpAds_checkIds()
{
    global $clientid, $campaignid, $bannerid, $affiliateid, $zoneid, $userlogid, $day;
    // I also put it there to avoid problems during the check on client/affiliate interface
    if (phpAds_isUser(phpAds_Client)) {
        $clientid = phpAds_getUserID();
    } elseif (phpAds_isUser(phpAds_Affiliate)) {
        $affiliateid = phpAds_getUserID();
    }
    // Reset missing variables
    if (!isset($clientid)) {
        $clientid = '';
    }
    if (!isset($campaignid)) {
        $campaignid = '';
    }
    if (!isset($bannerid)) {
        $bannerid = '';
    }
    if (!isset($affiliateid)) {
        $affiliateid = '';
    }
    if (!isset($zoneid)) {
        $zoneid = '';
    }
    if (!isset($userlogid)) {
        $userlogid = '';
    }
    if (!isset($day)) {
        $day = '';
    }
    $part = explode('-', str_replace('.php', '-', basename($_SERVER['SCRIPT_NAME'])));
    if ($stats = $part[0] == 'stats' ? 1 : 0) {
        array_shift($part);
        $redirects = array('client' => 'stats-global-client.php', 'campaign' => 'stats-client-campaigns.php', 'banner' => 'stats-campaign-banners.php', 'affiliate' => 'stats-global-affiliates.php', 'zone' => 'stats-affiliate-zones.php');
    } else {
        $redirects = array('client' => 'client-index.php', 'campaign' => 'client-campaigns.php', 'banner' => 'campaign-banners.php', 'affiliate' => 'affiliate-index.php', 'zone' => 'affiliate-zones.php');
    }
    // *-edit and *-index pages doesn't need ids when adding new item, lowering requirements
    if (isset($part[1]) && ($part[1] == 'edit' || $part[1] == 'index')) {
        if ($part[0] == 'client') {
            $part[0] = '';
        } elseif ($part[0] == 'campaign') {
            $part[0] = 'client';
        } elseif ($part[0] == 'banner') {
            $part[0] = 'campaign';
        } elseif ($part[0] == 'affiliate') {
            $part[0] = '';
        } elseif ($part[0] == 'zone') {
            $part[0] = 'affiliate';
        }
    }
    switch ($part[0]) {
        case 'banner':
            if (!is_numeric($bannerid)) {
                if (is_numeric($clientid) && is_numeric($campaignid)) {
                    // Banner-activate and banner-delete are also allowed to use only the campaign id
                    if ($part[1] == 'activate' || $part[1] == 'delete') {
                        break;
                    }
                    header('Location: ' . $redirects['banner'] . '?clientid=' . $clientid . '&campaignid=' . $campaignid);
                    exit;
                }
            } elseif (isset($part[1]) && $part[1] == 'htmlpreview') {
                break;
            }
        case 'campaign':
            if (!is_numeric($campaignid)) {
                if (is_numeric($clientid)) {
                    header('Location: ' . $redirects['campaign'] . '?clientid=' . $clientid);
                    exit;
                }
            }
        case 'client':
            if (!is_numeric($clientid)) {
                header('Location: ' . $redirects['client']);
                exit;
            }
            break;
        case 'zone':
        case 'linkedbanners':
            if (!is_numeric($zoneid)) {
                if (is_numeric($affiliateid)) {
                    header('Location: ' . $redirects['zone'] . '?affiliateid=' . $affiliateid);
                    exit;
                }
            }
        case 'affiliate':
            if (!is_numeric($affiliateid)) {
                header('Location: ' . $redirects['affiliate']);
                exit;
            }
            break;
    }
}
             }
             /*
               Deactivated for now because of security reasons -- Niels
               if (phpAds_isUser(phpAds_Admin) || (phpAds_isUser(phpAds_Client) && phpAds_isAllowed(phpAds_ModifyBanner))) // only for the admin
             */
             if (phpAds_isUser(phpAds_Admin)) {
                 echo "<a href='banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $row_banners['bannerid'] . "'>";
                 echo "<img src='images/icon-edit.gif' align='absmiddle' border='0'>&nbsp;" . $strBannerProperties . "</a>";
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
             }
             if (phpAds_isUser(phpAds_Client) && phpAds_isAllowed(phpAds_DisableBanner) && $row_banners['active'] == 't') {
                 echo "<a href='banner-activate.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $row_banners['bannerid'] . "&value=t'>";
                 echo "<img src='images/icon-deactivate.gif' align='absmiddle' border='0'>&nbsp;" . $strDeActivate . "</a>";
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
             }
             if (phpAds_isUser(phpAds_Client) && phpAds_isAllowed(phpAds_ActivateBanner) && $row_banners['active'] != 't') {
                 echo "<a href='banner-activate.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $row_banners['bannerid'] . "&value=f'>";
                 echo "<img src='images/icon-activate.gif' align='absmiddle' border='0'>&nbsp;" . $strActivate . "</a>";
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
             }
             echo "</tr><td>";
             echo "</table>";
             echo "</div>";
         }
         echo "</td></tr>";
     }
 }
 echo "<tr><td height='1' colspan='6' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
 echo "<tr>";
 echo "<form action='stats-campaign-banners.php'>";
 echo "<td colspan='6' height='35' align='right'>";
/* Copyright (c) 2000-2002 by the phpAdsNew developers                  */
/* For more information visit: http://www.phpadsnew.com                 */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
// Include required files
require "config.php";
require "lib-statistics.inc.php";
require "../libraries/lib-reports.inc.php";
// Register input variables
phpAds_registerGlobal('startday', 'startmonth', 'startyear', 'endday', 'endmonth', 'endyear');
// Security check
phpAds_checkAccess(phpAds_Admin + phpAds_Agency);
if (phpAds_isUser(phpAds_Agency)) {
    $query = "SELECT clientid FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid=" . $clientid . " AND agencyid=" . phpAds_getUserID();
    $res = phpAds_dbQuery($query) or phpAds_sqlDie();
    if (phpAds_dbNumRows($res) == 0) {
        phpAds_PageHeader("2");
        phpAds_Die($strAccessDenied, $strNotAdmin);
    }
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
if (isset($clientid) && $clientid != '') {
    if (isset($startyear) && isset($startmonth) && isset($startday) && $startyear != '' && $startmonth != '' && $startday != '') {
        $first_unixtimestamp = mktime(0, 0, 0, $startmonth, $startday, $startyear);
    } else {
        $first_unixtimestamp = 0;
        $row = phpAds_dbFetchArray($result);
        if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"]) {
            phpAds_PageHeader("1");
            phpAds_Die($strAccessDenied, $strNotAdmin);
        } else {
            $affiliateid = phpAds_getUserID();
        }
    } else {
        phpAds_PageHeader("1");
        phpAds_Die($strAccessDenied, $strNotAdmin);
    }
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (phpAds_isUser(phpAds_Admin)) {
    if ($phpAds_config['compact_stats']) {
        $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tDISTINCT bannerid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie();
    } else {
        $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tDISTINCT bannerid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie();
    }
    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 "</tr>";
    echo "<tr height='1'>";
    echo "<td " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><img src='images/spacer.gif' width='1' height='1'></td>";
    echo "<td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td>";
    echo "</tr>";
    echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">";
    // Empty
    echo "<td>&nbsp;</td>";
    // Button 1, 2 & 3
    echo "<td height='25' colspan='3'>";
    if (phpAds_isUser(phpAds_Admin) || phpAds_isAllowed(phpAds_LinkBanners)) {
        echo "<a href='zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $row_zones['zoneid'] . "'><img src='images/icon-zone-linked.gif' border='0' align='absmiddle' alt='{$strIncludedBanners}'>&nbsp;{$strIncludedBanners}</a>&nbsp;&nbsp;&nbsp;&nbsp;";
    }
    echo "<a href='zone-probability.php?affiliateid=" . $affiliateid . "&zoneid=" . $row_zones['zoneid'] . "'><img src='images/icon-zone-probability.gif' border='0' align='absmiddle' alt='{$strProbability}'>&nbsp;{$strProbability}</a>&nbsp;&nbsp;&nbsp;&nbsp;";
    echo "<a href='zone-invocation.php?affiliateid=" . $affiliateid . "&zoneid=" . $row_zones['zoneid'] . "'><img src='images/icon-generatecode.gif' border='0' align='absmiddle' alt='{$strInvocationcode}'>&nbsp;{$strInvocationcode}</a>&nbsp;&nbsp;&nbsp;&nbsp;";
    if (phpAds_isUser(phpAds_Admin) || phpAds_isAllowed(phpAds_DeleteZone)) {
        echo "<a href='zone-delete.php?affiliateid=" . $affiliateid . "&zoneid=" . $row_zones['zoneid'] . "&returnurl=affiliate-zones.php'" . phpAds_DelConfirm($strConfirmDeleteZone) . "><img src='images/icon-recycle.gif' border='0' align='absmiddle' alt='{$strDelete}'>&nbsp;{$strDelete}</a>&nbsp;&nbsp;&nbsp;&nbsp;";
    }
    echo "</td></tr>";
    $i++;
}
if (phpAds_dbNumRows($res_zones) > 0) {
    echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
}
echo "</table>";
echo "<br><br>";
/*********************************************************/
/* Store preferences                                     */
/*********************************************************/
$Session['prefs']['affiliate-zones.php']['listorder'] = $listorder;
$Session['prefs']['affiliate-zones.php']['orderdirection'] = $orderdirection;
Пример #12
0
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++;
            }
        }
    }
}
function phpAds_placeInvocationForm($extra = '', $zone_invocation = false)
{
    global $HTTP_SERVER_VARS, $block, $blockcampaign, $campaignid, $clientid, $codetype, $delay, $delay_type, $generate, $height, $hostlanguage, $ilayer, $layerstyle, $left, $location, $menubar, $phpAds_config, $phpAds_TextDirection, $popunder, $raw, $refresh, $resizable, $resize, $scrollbars, $source, $status, $submitbutton, $tabindex, $target, $template, $timeout, $toolbars, $top, $transparent, $uniqueid, $what, $width, $withtext, $bannerid;
    // Check if affiliate is on the same server
    if ($extra != '' && isset($extra['website']) && $extra['website']) {
        $server_phpads = parse_url($phpAds_config['url_prefix']);
        $server_affilate = parse_url($extra['website']);
        $server_same = @gethostbyname($server_phpads['host']) == @gethostbyname($server_affilate['host']);
    } else {
        $server_same = true;
    }
    // Hide when integrated in zone-advanced.php
    if (!is_array($extra) || !isset($extra['zoneadvanced']) || !$extra['zoneadvanced']) {
        echo "<form name='generate' action='" . $HTTP_SERVER_VARS['PHP_SELF'] . "' method='POST'>\n";
    }
    // Invocation type selection
    if (!is_array($extra) || isset($extra['delivery']) && $extra['delivery'] != phpAds_ZoneInterstitial && $extra['delivery'] != phpAds_ZonePopup) {
        $allowed['adlayer'] = $phpAds_config['allow_invocation_interstitial'];
        $allowed['popup'] = $phpAds_config['allow_invocation_popup'];
        $allowed['xmlrpc'] = $phpAds_config['allow_invocation_xmlrpc'];
        $allowed['adframe'] = $phpAds_config['allow_invocation_frame'];
        $allowed['adjs'] = $phpAds_config['allow_invocation_js'];
        $allowed['adview'] = $phpAds_config['allow_invocation_plain'];
        $allowed['adviewnocookies'] = $phpAds_config['allow_invocation_plain_nocookies'];
        $allowed['local'] = $phpAds_config['allow_invocation_local'];
        if (is_array($extra)) {
            $allowed['popup'] = false;
        }
        if (is_array($extra)) {
            $allowed['adlayer'] = false;
        }
        if (is_array($extra) && $server_same == false) {
            $allowed['local'] = false;
        }
        if (is_array($extra) && $server_same == false && ($extra['width'] == '-1' || $extra['height'] == '-1')) {
            $allowed['adframe'] = false;
        }
        if (is_array($extra) && $extra['delivery'] == phpAds_ZoneText) {
            // Only allow Javascript and Localmode
            // when using text ads
            $allowed['adlayer'] = $allowed['popup'] = $allowed['adframe'] = $allowed['adview'] = false;
            $allowed['adviewnocookies'] = false;
        }
        if (!isset($codetype) || $allowed[$codetype] == false) {
            while (list($k, $v) = each($allowed)) {
                if ($v) {
                    $codetype = $k;
                }
            }
        }
        if (!isset($codetype)) {
            $codetype = '';
        }
        echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
        echo "<tr><td height='25' colspan='3'><b>" . $GLOBALS['strChooseInvocationType'] . "</b></td></tr>";
        echo "<tr><td height='35'>";
        echo "<select name='codetype' onChange=\"this.form.submit()\" accesskey=" . $GLOBALS['keyList'] . " tabindex='" . $tabindex++ . "'>";
        if ($allowed['adview']) {
            echo "<option value='adview'" . ($codetype == 'adview' ? ' selected' : '') . ">" . $GLOBALS['strInvocationRemote'] . "</option>";
        }
        if ($allowed['adviewnocookies']) {
            echo "<option value='adviewnocookies'" . ($codetype == 'adviewnocookies' ? ' selected' : '') . ">" . $GLOBALS['strInvocationRemoteNoCookies'] . "</option>";
        }
        if ($allowed['adjs']) {
            echo "<option value='adjs'" . ($codetype == 'adjs' ? ' selected' : '') . ">" . $GLOBALS['strInvocationJS'] . "</option>";
        }
        if ($allowed['adframe']) {
            echo "<option value='adframe'" . ($codetype == 'adframe' ? ' selected' : '') . ">" . $GLOBALS['strInvocationIframes'] . "</option>";
        }
        if ($allowed['xmlrpc']) {
            echo "<option value='xmlrpc'" . ($codetype == 'xmlrpc' ? ' selected' : '') . ">" . $GLOBALS['strInvocationXmlRpc'] . "</option>";
        }
        if ($allowed['popup']) {
            echo "<option value='popup'" . ($codetype == 'popup' ? ' selected' : '') . ">" . $GLOBALS['strInvocationPopUp'] . "</option>";
        }
        if ($allowed['adlayer']) {
            echo "<option value='adlayer'" . ($codetype == 'adlayer' ? ' selected' : '') . ">" . $GLOBALS['strInvocationAdLayer'] . "</option>";
        }
        if ($allowed['local']) {
            echo "<option value='local'" . ($codetype == 'local' ? ' selected' : '') . ">" . $GLOBALS['strInvocationLocal'] . "</option>";
        }
        echo "</select>";
        echo "&nbsp;<input type='image' src='images/" . $phpAds_TextDirection . "/go_blue.gif' border='0'>";
        echo "</td></tr></table>";
        phpAds_ShowBreak();
        echo "<br>";
    } else {
        if ($extra['delivery'] == phpAds_ZoneInterstitial) {
            $codetype = 'adlayer';
        }
        if ($extra['delivery'] == phpAds_ZonePopup) {
            $codetype = 'popup';
        }
        if (!isset($codetype)) {
            $codetype = '';
        }
    }
    if ($codetype == 'adlayer') {
        if (!isset($layerstyle)) {
            $layerstyle = 'geocities';
        }
        include '../libraries/layerstyles/' . $layerstyle . '/invocation.inc.php';
    }
    //
    if ($codetype != '') {
        // Code
        if (isset($submitbutton) || isset($generate) && $generate) {
            echo "<table border='0' width='550' cellpadding='0' cellspacing='0'>";
            echo "<tr><td height='25'><img src='images/icon-generatecode.gif' align='absmiddle'>&nbsp;<b>" . $GLOBALS['strBannercode'] . "</b></td>";
            // Show clipboard button only on IE
            if (strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'], 'MSIE') > 0 && strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'], 'Opera') < 1) {
                echo "<td height='25' align='right'><img src='images/icon-clipboard.gif' align='absmiddle'>&nbsp;";
                echo "<a href='javascript:phpAds_CopyClipboard(\"bannercode\");'>" . $GLOBALS['strCopyToClipboard'] . "</a></td></tr>";
            } else {
                echo "<td>&nbsp;</td>";
            }
            echo "<tr height='1'><td colspan='2' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
            echo "<tr><td colspan='2'><textarea name='bannercode' class='code-gray' rows='6' cols='55' style='width:550;' readonly>" . htmlspecialchars(phpAds_GenerateInvocationCode()) . "</textarea></td></tr>";
            echo "</table><br>";
            phpAds_ShowBreak();
            echo "<br>";
            $generated = true;
        } else {
            $generated = false;
        }
        // Hide when integrated in zone-advanced.php
        if (!(is_array($extra) && isset($extra['zoneadvanced']) && $extra['zoneadvanced'])) {
            // Header
            //Parameters Section
            echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
            echo "<tr><td height='25' colspan='3'><img src='images/icon-overview.gif' align='absmiddle'>&nbsp;<b>" . $GLOBALS['strParameters'] . "</b></td></tr>";
            echo "<tr height='1'><td width='30'><img src='images/break.gif' height='1' width='30'></td>";
            echo "<td width='200'><img src='images/break.gif' height='1' width='200'></td>";
            echo "<td width='100%'><img src='images/break.gif' height='1' width='100%'></td></tr>";
            echo "<tr" . ($zone_invocation || $codetype == 'adviewnocookies' ? '' : " bgcolor='#F6F6F6'") . "><td height='10' colspan='3'>&nbsp;</td></tr>";
            //echo "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
        }
        if ($codetype == 'adview') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true);
        }
        if ($codetype == 'adviewnocookies') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true, 'bannerid' => true);
        }
        if ($codetype == 'adjs') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'block' => true, 'target' => true, 'source' => true, 'withtext' => true, 'blockcampaign' => true);
        }
        if ($codetype == 'adframe') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true, 'refresh' => true, 'size' => true, 'resize' => true, 'transparent' => true, 'ilayer' => true);
        }
        if ($codetype == 'ad') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true, 'withtext' => true, 'size' => true, 'resize' => true, 'transparent' => true);
        }
        if ($codetype == 'popup') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true, 'absolute' => true, 'popunder' => true, 'timeout' => true, 'delay' => true, 'windowoptions' => true);
        }
        if ($codetype == 'adlayer') {
            $show = phpAds_getLayerShowVar();
        }
        if ($codetype == 'xmlrpc') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true, 'withtext' => true, 'template' => true, 'hostlanguage' => true);
        }
        if ($codetype == 'local') {
            $show = array('what' => true, 'clientid' => true, 'campaignid' => true, 'target' => true, 'source' => true, 'withtext' => true, 'block' => true, 'blockcampaign' => true, 'raw' => true);
        }
        // What
        if (!$zone_invocation && isset($show['what']) && $show['what'] == true && $codetype != 'adviewnocookies') {
            echo "<tr bgcolor='#F6F6F6'><td width='30'>&nbsp;</td>";
            echo "<td width='200' valign='top'>" . $GLOBALS['strInvocationWhat'] . "</td><td width='370'>";
            echo "<textarea class='flat' name='what' rows='3' cols='50' style='width:350px;' tabindex='" . $tabindex++ . "'>" . (isset($what) ? stripslashes($what) : '') . "</textarea></td></tr>";
            echo "<tr bgcolor='#F6F6F6'><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
            echo "<td bgcolor='#F6F6F6' colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
        }
        /* Remove advetiser from direct invocation - not needed
        		// ClientID
        		if (!$zone_invocation && isset($show['clientid']) && $show['clientid'] == true)
        		{
        			// Display available advertisers...
        			echo "<tr bgcolor='#F6F6F6'><td width='30'>&nbsp;</td>\n";
        			echo "<td width='200'>".$GLOBALS['strInvocationClientID']."</td><td width='370'>\n";
        			echo "<select name='clientid' style='width:350px;' tabindex='".($tabindex++)."'>\n";
        				echo "<option value='0'>-</option>\n";
        			
        			$res = phpAds_dbQuery(
        				"SELECT clientid, clientname".
        				" FROM ".$phpAds_config['tbl_clients']
        			) or phpAds_sqlDie();
        				
        			while ($row = phpAds_dbFetchArray($res))
        			{
        				echo "<option value='".$row['clientid']."'".($clientid == $row['clientid'] ? ' selected' : '').">";
        				echo phpAds_buildName ($row['clientid'], $row['clientname']);
        				echo "</option>\n";
        			}
        			
        			echo "</select>\n";
        			echo "</td></tr>";
        //			echo "<tr bgcolor='#F6F6F6'><td height='10' colspan='3'>&nbsp;</td></tr>";
        //			echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
        //			echo "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
        			echo "<tr bgcolor='#F6F6F6'><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        			echo "<td bgcolor='#F6F6F6' colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
        		}
        		*/
        // CampaignID
        if (!$zone_invocation && isset($show['campaignid']) && $show['campaignid'] == true && $codetype != 'adviewnocookies') {
            // Display available campaigns...
            echo "<tr bgcolor='#F6F6F6'><td width='30'>&nbsp;</td>\n";
            echo "<td width='200'>" . $GLOBALS['strInvocationCampaignID'] . "</td><td width='370'>\n";
            echo "<select name='campaignid' style='width:350px;' tabindex='" . $tabindex++ . "'>\n";
            echo "<option value='0'>-</option>\n";
            if (phpAds_isUser(phpAds_Admin)) {
                $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'];
            } elseif (phpAds_isUser(phpAds_Agency)) {
                $query = "SELECT m.campaignid AS campaignid" . ",m.campaignname AS campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND c.agencyid=" . phpAds_getAgencyID();
            }
            $res = phpAds_dbQuery($query) or phpAds_sqlDie();
            while ($row = phpAds_dbFetchArray($res)) {
                echo "<option value='" . $row['campaignid'] . "'" . ($campaignid == $row['campaignid'] ? ' selected' : '') . ">";
                echo phpAds_buildName($row['campaignid'], $row['campaignname']);
                echo "</option>\n";
            }
            echo "</select>\n";
            echo "</td></tr>";
            echo "<tr bgcolor='#F6F6F6'><td height='10' colspan='3'>&nbsp;</td></tr>";
            echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
            echo "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
        }
        // BannerID
        if (isset($show['bannerid']) && $show['bannerid'] == true) {
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationBannerID'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='bannerid' size='' value='" . (isset($bannerid) ? $bannerid : '') . "' style='width:175px;' tabindex='" . $tabindex++ . "'></td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
        }
        // Target
        if (isset($show['target']) && $show['target'] == true) {
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationTarget'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='target' size='' value='" . (isset($target) ? $target : '') . "' style='width:175px;' tabindex='" . $tabindex++ . "'></td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Source
        if (isset($show['source']) && $show['source'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationSource'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='source' size='' value='" . (isset($source) ? $source : '') . "' style='width:175px;' tabindex='" . $tabindex++ . "'></td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // WithText
        if (isset($show['withtext']) && $show['withtext'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationWithText'] . "</td>";
            echo "<td width='370'><input type='radio' name='withtext' value='1'" . (isset($withtext) && $withtext != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "<input type='radio' name='withtext' value='0'" . (!isset($withtext) || $withtext == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // refresh
        if (isset($show['refresh']) && $show['refresh'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strIFrameRefreshAfter'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='refresh' size='' value='" . (isset($refresh) ? $refresh : '') . "' style='width:175px;' tabindex='" . $tabindex++ . "'> " . $GLOBALS['strAbbrSeconds'] . "</td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // size
        if (!$zone_invocation && isset($show['size']) && $show['size'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strFrameSize'] . "</td><td width='370'>";
            echo $GLOBALS['strWidth'] . ": <input class='flat' type='text' name='width' size='3' value='" . (isset($width) ? $width : '') . "' tabindex='" . $tabindex++ . "'>&nbsp;&nbsp;&nbsp;";
            echo $GLOBALS['strHeight'] . ": <input class='flat' type='text' name='height' size='3' value='" . (isset($height) ? $height : '') . "' tabindex='" . $tabindex++ . "'>";
            echo "</td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Resize
        if (isset($show['resize']) && $show['resize'] == true) {
            // Only show this if affiliate is on the same server
            if ($server_same) {
                echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
                echo "<tr><td width='30'>&nbsp;</td>";
                echo "<td width='200'>" . $GLOBALS['strIframeResizeToBanner'] . "</td>";
                echo "<td width='370'><input type='radio' name='resize' value='1'" . (isset($resize) && $resize == 1 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
                echo "<input type='radio' name='resize' value='0'" . (!isset($resize) || $resize == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
                echo "</tr>";
                echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
            } else {
                echo "<input type='hidden' name='resize' value='0'>";
            }
        }
        // Transparent
        if (isset($show['transparent']) && $show['transparent'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strIframeMakeTransparent'] . "</td>";
            echo "<td width='370'><input type='radio' name='transparent' value='1'" . (isset($transparent) && $transparent == 1 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "<input type='radio' name='transparent' value='0'" . (!isset($transparent) || $transparent == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Netscape 4 ilayer
        if (isset($show['ilayer']) && $show['ilayer'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strIframeIncludeNetscape4'] . "</td>";
            echo "<td width='370'><input type='radio' name='ilayer' value='1'" . (isset($ilayer) && $ilayer == 1 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "<input type='radio' name='ilayer' value='0'" . (!isset($ilayer) || $ilayer == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Block
        if (isset($show['block']) && $show['block'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationDontShowAgain'] . "</td>";
            echo "<td width='370'><input type='radio' name='block' value='1'" . (isset($block) && $block != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "<input type='radio' name='block' value='0'" . (!isset($block) || $block == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Blockcampaign
        if (isset($show['blockcampaign']) && $show['blockcampaign'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationDontShowAgainCampaign'] . "</td>";
            echo "<td width='370'><input type='radio' name='blockcampaign' value='1'" . (isset($blockcampaign) && $blockcampaign != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "<input type='radio' name='blockcampaign' value='0'" . (!isset($blockcampaign) || $blockcampaign == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Raw
        if (isset($show['raw']) && $show['raw'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strInvocationTemplate'] . "</td>";
            echo "<td width='370'><input type='radio' name='raw' value='1'" . (isset($raw) && $raw != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "<input type='radio' name='raw' value='0'" . (!isset($raw) || $raw == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // AdLayer style
        if (isset($show['layerstyle']) && $show['layerstyle'] == true) {
            $layerstyles = array();
            $stylesdir = opendir('../libraries/layerstyles');
            while ($stylefile = readdir($stylesdir)) {
                if (is_dir('../libraries/layerstyles/' . $stylefile) && file_exists('../libraries/layerstyles/' . $stylefile . '/invocation.inc.php')) {
                    if (ereg('^[^.]', $stylefile)) {
                        $layerstyles[$stylefile] = isset($GLOBALS['strAdLayerStyleName'][$stylefile]) ? $GLOBALS['strAdLayerStyleName'][$stylefile] : str_replace("- ", "-", ucwords(str_replace("-", "- ", $stylefile)));
                    }
                }
            }
            closedir($stylesdir);
            asort($layerstyles, SORT_STRING);
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strAdLayerStyle'] . "</td><td width='370'>";
            echo "<select name='layerstyle' onChange='this.form.submit()' style='width:175px;' tabindex='" . $tabindex++ . "'>";
            while (list($k, $v) = each($layerstyles)) {
                echo "<option value='{$k}'" . ($layerstyle == $k ? ' selected' : '') . ">{$v}</option>";
            }
            echo "</select>";
            echo "</td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // popunder
        if (isset($show['popunder']) && $show['popunder'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strPopUpStyle'] . "</td>";
            echo "<td width='370'><input type='radio' name='popunder' value='0'" . (!isset($popunder) || $popunder != '1' ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . "<img src='images/icon-popup-over.gif' align='absmiddle'>&nbsp;" . $GLOBALS['strPopUpStylePopUp'] . "<br>";
            echo "<input type='radio' name='popunder' value='1'" . (isset($popunder) && $popunder == '1' ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . "<img src='images/icon-popup-under.gif' align='absmiddle'>&nbsp;" . $GLOBALS['strPopUpStylePopUnder'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // delay
        if (isset($show['delay']) && $show['delay'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strPopUpCreateInstance'] . "</td>";
            echo "<td width='370'><input type='radio' name='delay_type' value='none'" . (!isset($delay_type) || $delay_type != 'exit' && $delay_type != 'seconds' ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strPopUpImmediately'] . "<br>";
            echo "<input type='radio' name='delay_type' value='exit'" . (isset($delay_type) && $delay_type == 'exit' ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strPopUpOnClose'] . "<br>";
            echo "<input type='radio' name='delay_type' value='seconds'" . (isset($delay_type) && $delay_type == 'seconds' ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strPopUpAfterSec'] . "&nbsp;" . "<input class='flat' type='text' name='delay' size='' value='" . (isset($delay) ? $delay : '-') . "' style='width:50px;' tabindex='" . $tabindex++ . "'> " . $GLOBALS['strAbbrSeconds'] . "</td>";
            echo "</tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // absolute
        if (isset($show['absolute']) && $show['absolute'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strPopUpTop'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='top' size='' value='" . (isset($top) ? $top : '-') . "' style='width:50px;' tabindex='" . $tabindex++ . "'> " . $GLOBALS['strAbbrPixels'] . "</td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strPopUpLeft'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='left' size='' value='" . (isset($left) ? $left : '-') . "' style='width:50px;' tabindex='" . $tabindex++ . "'> " . $GLOBALS['strAbbrPixels'] . "</td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // timeout
        if (isset($show['timeout']) && $show['timeout'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strAutoCloseAfter'] . "</td><td width='370'>";
            echo "<input class='flat' type='text' name='timeout' size='' value='" . (isset($timeout) ? $timeout : '-') . "' style='width:50px;' tabindex='" . $tabindex++ . "'> " . $GLOBALS['strAbbrSeconds'] . "</td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Window options
        if (isset($show['windowoptions']) && $show['windowoptions'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td><td width='200' valign='top'>" . $GLOBALS['strWindowOptions'] . "</td><td width='370'>";
            echo "<table cellpadding='0' cellspacing='0' border='0'>";
            echo "<tr><td>" . $GLOBALS['strShowToolbars'] . "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='toolbars' value='1'" . (isset($toolbars) && $toolbars != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='toolbars' value='0'" . (!isset($toolbars) || $toolbars == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "";
            echo "</td></tr><tr><td colspan='5'><img src='images/break-l.gif' height='1' width='200' vspace='2'></td></tr>";
            echo "<tr><td>" . $GLOBALS['strShowLocation'] . "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='location' value='1'" . (isset($location) && $location != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='location' value='0'" . (!isset($location) || $location == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "";
            echo "</td></tr><tr><td colspan='5'><img src='images/break-l.gif' height='1' width='200' vspace='2'></td></tr>";
            echo "<tr><td>" . $GLOBALS['strShowMenubar'] . "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='menubar' value='1'" . (isset($menubar) && $menubar != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='menubar' value='0'" . (!isset($menubar) || $menubar == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "";
            echo "</td></tr><tr><td colspan='5'><img src='images/break-l.gif' height='1' width='200' vspace='2'></td></tr>";
            echo "<tr><td>" . $GLOBALS['strShowStatus'] . "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='status' value='1'" . (isset($status) && $status != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='status' value='0'" . (!isset($status) || $status == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "";
            echo "</td></tr><tr><td colspan='5'><img src='images/break-l.gif' height='1' width='200' vspace='2'></td></tr>";
            echo "<tr><td>" . $GLOBALS['strWindowResizable'] . "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='resizable' value='1'" . (isset($resizable) && $resizable != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='resizable' value='0'" . (!isset($resizable) || $resizable == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "";
            echo "</td></tr><tr><td colspan='5'><img src='images/break-l.gif' height='1' width='200' vspace='2'></td></tr>";
            echo "<tr><td>" . $GLOBALS['strShowScrollbars'] . "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='scrollbars' value='1'" . (isset($scrollbars) && $scrollbars != 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strYes'] . "<br>";
            echo "</td><td>&nbsp;&nbsp;&nbsp;</td><td>";
            echo "<input type='radio' name='scrollbars' value='0'" . (!isset($scrollbars) || $scrollbars == 0 ? ' checked' : '') . " tabindex='" . $tabindex++ . "'>&nbsp;" . $GLOBALS['strNo'] . "";
            echo "</td></tr>";
            echo "</table>";
            echo "</td></tr><tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // AdLayer custom code
        if (isset($show['layercustom']) && $show['layercustom'] == true) {
            phpAds_placeLayerSettings();
        }
        // Host Language
        if (isset($show['hostlanguage']) && $show['hostlanguage'] == true) {
            echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>";
            echo "<tr><td width='30'>&nbsp;</td>";
            echo "<td width='200'>" . $GLOBALS['strXmlRpcLanguage'] . "</td><td width='370'>";
            echo "<select name='hostlanguage' tabindex='" . $tabindex++ . "'>";
            echo "<option value='php'" . ($hostlanguage == 'php' ? ' selected' : '') . ">PHP</option>";
            //		echo "<option value='php-xmlrpc'".($hostlanguage == 'php-xmlrpc' ? ' selected' : '').">PHP with built in XML-RPC extension</option>";
            //		echo "<option value='asp'".($hostlanguage == 'asp' ? ' selected' : '').">ASP</option>";
            //		echo "<option value='jsp'".($hostlanguage == 'jsp' ? ' selected' : '').">JSP</option>";
            echo "</select>";
            echo "</td></tr>";
            echo "<tr><td width='30'><img src='images/spacer.gif' height='1' width='100%'></td>";
        }
        // Hide when integrated in zone-advanced.php
        if (!(is_array($extra) && isset($extra['zoneadvanced']) && $extra['zoneadvanced'])) {
            // Footer
            echo "<tr><td height='10' colspan='3'>&nbsp;</td></tr>";
            echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
            echo "</table>";
            echo "<br><br>";
            echo "<input type='hidden' value='" . ($generated ? 1 : 0) . "' name='generate'>";
            if ($generated) {
                echo "<input type='submit' value='" . $GLOBALS['strRefresh'] . "' name='submitbutton' tabindex='" . $tabindex++ . "'>";
            } else {
                echo "<input type='submit' value='" . $GLOBALS['strGenerate'] . "' name='submitbutton' tabindex='" . $tabindex++ . "'>";
            }
        }
    }
    // Put extra hidden fields
    if (is_array($extra)) {
        while (list($k, $v) = each($extra)) {
            echo "<input type='hidden' value='{$v}' name='{$k}'>";
        }
    }
    // Hide when integrated in zone-advanced.php
    if (!is_array($extra) || !isset($extra['zoneadvanced']) || !$extra['zoneadvanced']) {
        echo "</form><br><br>";
    }
}
Пример #14
0
phpAds_PrepareHelp();
phpAds_PageHeader("5.1");
if (phpAds_isUser(phpAds_Admin)) {
    phpAds_ShowSections(array("5.1", "5.3", "5.4", "5.2", "5.5"));
} elseif (phpAds_isUser(phpAds_Agency)) {
    phpAds_ShowSections(array("5.1"));
}
phpAds_SettingsSelection("banner");
/*********************************************************/
/* Cache settings fields and get help HTML Code          */
/*********************************************************/
// Split FTP settings
if (!empty($phpAds_config['type_web_ftp'])) {
    if ($ftpserver = @parse_url($phpAds_config['type_web_ftp'])) {
        $ftpserver['path'] = ereg_replace('^/', '', $ftpserver['path']);
        $ftpserver['path'] = ereg_replace('/$', '', $ftpserver['path']);
        $phpAds_config['type_web_ftp_host'] = $ftpserver['host'] . (isset($ftpserver['port']) && $ftpserver['port'] != '' ? ':' . $ftpserver['port'] : '');
        $phpAds_config['type_web_ftp_user'] = $ftpserver['user'];
        $phpAds_config['type_web_ftp_password'] = $ftpserver['pass'];
        $phpAds_config['type_web_ftp_path'] = $ftpserver['path'];
    }
}
$settings = array(array('text' => $strDefaultBanners, 'items' => array(array('type' => 'text', 'name' => 'default_banner_url', 'text' => $strDefaultBannerUrl, 'size' => 35, 'check' => 'url'), array('type' => 'break'), array('type' => 'text', 'name' => 'default_banner_target', 'text' => $strDefaultBannerTarget, 'size' => 35, 'check' => 'url'))), array('text' => $strAllowedBannerTypes, 'items' => array(array('type' => 'checkbox', 'name' => 'type_sql_allow', 'text' => $strTypeSqlAllow), array('type' => 'checkbox', 'name' => 'type_web_allow', 'text' => $strTypeWebAllow), array('type' => 'checkbox', 'name' => 'type_url_allow', 'text' => $strTypeUrlAllow), array('type' => 'checkbox', 'name' => 'type_html_allow', 'text' => $strTypeHtmlAllow), array('type' => 'checkbox', 'name' => 'type_txt_allow', 'text' => $strTypeTxtAllow))), array('text' => $strTypeWebSettings, 'visible' => phpAds_isUser(phpAds_Admin), 'items' => array(array('type' => 'select', 'name' => 'type_web_mode', 'text' => $strTypeWebMode, 'items' => array($strTypeWebModeLocal, $strTypeWebModeFtp), 'depends' => 'type_web_allow==true'), array('type' => 'break'), array('type' => 'text', 'name' => 'type_web_url', 'text' => $strTypeWebUrl, 'size' => 35, 'check' => 'url', 'depends' => 'type_web_allow==true'), array('type' => 'break'), array('type' => 'text', 'name' => 'type_web_ssl_url', 'text' => $strTypeWebSslUrl, 'size' => 35, 'check' => 'url', 'depends' => 'type_web_allow==true'), array('type' => 'break', 'size' => 'full'), array('type' => 'text', 'name' => 'type_web_dir', 'text' => $strTypeWebDir, 'size' => 35, 'depends' => 'type_web_allow==true && type_web_mode==0'), array('type' => 'break', 'size' => 'full'), array('type' => 'text', 'name' => 'type_web_ftp_host', 'text' => $strTypeFTPHost, 'size' => 35, 'depends' => 'type_web_allow==true && type_web_mode==1'), array('type' => 'break'), array('type' => 'text', 'name' => 'type_web_ftp_path', 'text' => $strTypeFTPDirectory, 'size' => 35, 'depends' => 'type_web_allow==true && type_web_mode==1'), array('type' => 'break'), array('type' => 'text', 'name' => 'type_web_ftp_user', 'text' => $strTypeFTPUsername, 'size' => 35, 'depends' => 'type_web_allow==true && type_web_mode==1'), array('type' => 'break'), array('type' => 'password', 'name' => 'type_web_ftp_password', 'text' => $strTypeFTPPassword, 'size' => 35, 'depends' => 'type_web_allow==true && type_web_mode==1'))), array('text' => $strTypeHtmlSettings, 'items' => array(array('type' => 'checkbox', 'name' => 'type_html_auto', 'text' => $strTypeHtmlAuto, 'depends' => 'type_html_allow==true'), array('type' => 'checkbox', 'name' => 'type_html_php', 'text' => $strTypeHtmlPhp, 'depends' => 'type_html_allow==true'))));
/*********************************************************/
/* Main code                                             */
/*********************************************************/
phpAds_ShowSettings($settings, $errormessage);
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
Пример #15
0
    phpAds_SettingsWriteAdd('insert_delayed', isset($insert_delayed));
    phpAds_SettingsWriteAdd('compatibility_mode', isset($compatibility_mode));
    if (!count($errormessage)) {
        phpAds_SettingsWriteFlush();
        header("Location: settings-invocation.php");
        exit;
    }
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PrepareHelp();
phpAds_PageHeader("5.1");
if (phpAds_isUser(phpAds_Admin)) {
    phpAds_ShowSections(array("5.1", "5.3", "5.4", "5.2", "5.5"));
} elseif (phpAds_isUser(phpAds_Agency)) {
    phpAds_ShowSections(array("5.1"));
}
phpAds_SettingsSelection("db");
/*********************************************************/
/* Cache settings fields and get help HTML Code          */
/*********************************************************/
$settings = array(array('text' => $strDatabaseServer, 'visible' => phpAds_isUser(phpAds_Admin), 'items' => array(array('type' => 'text', 'name' => 'dbhost', 'text' => $strDbHost, 'req' => true), array('type' => 'break'), array('type' => 'text', 'name' => 'dbport', 'text' => $strDbPort, 'req' => true), array('type' => 'break'), array('type' => 'text', 'name' => 'dbuser', 'text' => $strDbUser, 'req' => true), array('type' => 'break'), array('type' => 'password', 'name' => 'dbpassword', 'text' => $strDbPassword, 'req' => true), array('type' => 'break'), array('type' => 'text', 'name' => 'dbname', 'text' => $strDbName, 'req' => true))), array('text' => $strDatabaseOptimalisations, 'visible' => phpAds_isUser(phpAds_Admin), 'items' => array(array('type' => 'checkbox', 'name' => 'persistent_connections', 'text' => $strPersistentConnections), array('type' => 'checkbox', 'name' => 'insert_delayed', 'text' => $strInsertDelayed, 'visible' => $phpAds_productname == 'phpAdsNew' && $phpAds_config['table_type'] == 'MYISAM'), array('type' => 'checkbox', 'name' => 'compatibility_mode', 'text' => $strCompatibilityMode, 'visible' => $phpAds_productname == 'phpAdsNew'), array('type' => 'checkbox', 'name' => 'auto_clean_tables_vacuum', 'text' => $strAutoCleanVacuum, 'visible' => $phpAds_productname == 'phpPgAds'))));
/*********************************************************/
/* Main code                                             */
/*********************************************************/
phpAds_ShowSettings($settings, $errormessage);
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
$zoneids = array();
$idresult = phpAds_dbQuery("\n\tSELECT\n\t\tzoneid\n\tFROM\n\t\t" . $phpAds_config['tbl_zones'] . "\n\tWHERE\n\t\taffiliateid = '{$affiliateid}'\n");
while ($row = phpAds_dbFetchArray($idresult)) {
    $zoneids[] = "zoneid = " . $row['zoneid'];
}
$res = phpAds_dbQuery("\n\tSELECT\n\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\tFROM\n\t\t" . $phpAds_config['tbl_adstats'] . "\n\tWHERE\n\t\t(" . implode(' OR ', $zoneids) . ")\n\tGROUP BY\n\t\tday\n\tORDER BY\n\t\tday DESC\n\tLIMIT 7\n") or phpAds_sqlDie();
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext($row['date_formatted'], "stats-affiliate-daily-hosts.php?day=" . $row['date'] . "&affiliateid=" . $affiliateid, $day == $row['date']);
}
if (phpAds_isUser(phpAds_Admin)) {
    phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
    phpAds_PageHeader("2.4.1.2");
    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-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><br>";
    phpAds_ShowSections(array("2.4.1.1", "2.4.1.2"));
}
if (phpAds_isUser(phpAds_Affiliate)) {
    phpAds_PageHeader("1.2.2");
    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>";
    phpAds_ShowSections(array("1.2.1", "1.2.2"));
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$lib_hourly_where = "(" . implode(' OR ', $zoneids) . ")";
include "lib-hourly-hosts.inc.php";
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
Пример #17
0
function phpAds_showZoneBanners($width, $height, $what, $zonetype, $delivery)
{
    global $phpAds_config, $showcampaigns, $hideinactive, $affiliateid, $zoneid;
    global $strName, $strID, $strUntitled, $strDescription, $phpAds_TextAlignRight, $phpAds_TextAlignLeft;
    global $strEdit, $strCheckAllNone, $strShowBanner;
    global $strNoBannersToLink, $strSaveChanges, $strSelectBannerToLink, $strInactiveBannersHidden;
    global $strShowParentCampaigns, $strHideParentCampaigns, $strHideInactiveBanners, $strShowAll;
    global $tabindex;
    if ($zonetype == phpAds_ZoneBanners) {
        // Determine selected banners
        $what_array = explode(",", $what);
        for ($k = 0; $k < count($what_array); $k++) {
            if (substr($what_array[$k], 0, 9) == "bannerid:") {
                $bannerid = substr($what_array[$k], 9);
                $bannerids[$bannerid] = true;
            }
        }
    } elseif ($zonetype == phpAds_ZoneCampaign) {
        // Determine selected campaigns
        $clientids = array();
        $what_array = explode(",", $what);
        for ($k = 0; $k < count($what_array); $k++) {
            if (substr($what_array[$k], 0, 9) == "clientid:") {
                $clientid = substr($what_array[$k], 9);
                $clientids[] = 'clientid = ' . $clientid;
            }
        }
        // Determine banners owned by selected campaigns
        if (count($clientids)) {
            $res = phpAds_dbQuery("\n\t\t\t\tSELECT\n\t\t\t\t\tbannerid\n\t\t\t\tFROM\n\t\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\t\tWHERE\n\t\t\t\t\t" . implode(' OR ', $clientids) . "\n\t\t\t");
            while ($row = phpAds_dbFetchArray($res)) {
                $bannerids[$row['bannerid']] = true;
            }
        } else {
            $bannerids = array();
        }
    } else {
        $bannerids = array();
    }
    // Fetch all campaigns
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tparent > 0\n\t") or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        $campaigns[$row['clientid']] = $row;
    }
    // Fetch all banners which can be linked
    $query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t";
    if ($delivery != phpAds_ZoneText) {
        if ($width != -1 && $height != -1) {
            $query .= "WHERE width = {$width} AND height = {$height} AND contenttype != 'txt'";
        } elseif ($width != -1) {
            $query .= "WHERE width = {$width} AND contenttype != 'txt'";
        } elseif ($height != -1) {
            $query .= "WHERE height = {$height} AND contenttype != 'txt'";
        } else {
            $query .= "WHERE contenttype != 'txt'";
        }
    } else {
        $query .= "WHERE contenttype = 'txt'";
    }
    $query .= "\n\t\tORDER BY\n\t\t\tbannerid";
    $res = phpAds_dbQuery($query);
    $compact = phpAds_dbNumRows($res) > $phpAds_config['gui_link_compact_limit'];
    while ($row = phpAds_dbFetchArray($res)) {
        $campaigns[$row['clientid']]['banners'][$row['bannerid']] = $row;
    }
    $inactivehidden = 0;
    if (!$compact) {
        echo "<form name='zonetypeselection' method='post' action='zone-include.php'>";
        echo "<input type='hidden' name='zoneid' value='" . $GLOBALS['zoneid'] . "'>";
        echo "<input type='hidden' name='affiliateid' value='" . $GLOBALS['affiliateid'] . "'>";
        echo "<input type='hidden' name='zonetype' value='" . phpAds_ZoneBanners . "'>";
        echo "<input type='hidden' name='action' value='set'>";
    } else {
        echo "<br>" . $strSelectBannerToLink . "<br><br>";
        echo "<table cellpadding='0' cellspacing='0' border='0'><tr>";
        echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
        echo "<input type='hidden' name='zoneid' value='" . $GLOBALS['zoneid'] . "'>";
        echo "<input type='hidden' name='affiliateid' value='" . $GLOBALS['affiliateid'] . "'>";
        echo "<input type='hidden' name='zonetype' value='" . phpAds_ZoneBanners . "'>";
        echo "<td><img src='images/icon-client.gif' align='absmiddle'>&nbsp;";
        echo "<select name='clientid' onChange='this.form.submit();' tabindex='" . $tabindex++ . "'>";
        if (!isset($GLOBALS['clientid']) || $GLOBALS['clientid'] == '') {
            echo "<option value='' selected></option>";
        }
        // Fetch all campaigns
        $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\t\tWHERE\n\t\t\t\tparent = 0\n\t\t") or phpAds_sqlDie();
        while ($row = phpAds_dbFetchArray($res)) {
            if (isset($GLOBALS['clientid']) && $GLOBALS['clientid'] == $row['clientid']) {
                echo "<option value='" . $row['clientid'] . "' selected>[id" . $row['clientid'] . "] " . $row['clientname'] . "</option>";
            } else {
                echo "<option value='" . $row['clientid'] . "'>[id" . $row['clientid'] . "] " . $row['clientname'] . "</option>";
            }
        }
        echo "</select>";
        echo "</td></form>";
        if (isset($GLOBALS['clientid']) && $GLOBALS['clientid'] != '') {
            echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
            echo "<input type='hidden' name='zoneid' value='" . $GLOBALS['zoneid'] . "'>";
            echo "<input type='hidden' name='affiliateid' value='" . $GLOBALS['affiliateid'] . "'>";
            echo "<input type='hidden' name='clientid' value='" . $GLOBALS['clientid'] . "'>";
            echo "<input type='hidden' name='zonetype' value='" . phpAds_ZoneBanners . "'>";
            echo "<td>&nbsp;&nbsp;<img src='images/caret-r.gif' align='absmiddle'>&nbsp;&nbsp;";
            echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;";
            echo "<select name='campaignid' onChange='this.form.submit();' tabindex='" . $tabindex++ . "'>";
            if (!isset($GLOBALS['campaignid']) || $GLOBALS['campaignid'] == '') {
                echo "<option value='' selected></option>";
            }
            // Fetch all campaigns
            $res = phpAds_dbQuery("\n\t\t\t\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\t\t\tWHERE\n\t\t\t\t\tparent = " . $GLOBALS['clientid'] . "\n\t\t\t") or phpAds_sqlDie();
            while ($row = phpAds_dbFetchArray($res)) {
                if (isset($GLOBALS['campaignid']) && $GLOBALS['campaignid'] == $row['clientid']) {
                    echo "<option value='" . $row['clientid'] . "' selected>[id" . $row['clientid'] . "] " . $row['clientname'] . "</option>";
                } else {
                    echo "<option value='" . $row['clientid'] . "'>[id" . $row['clientid'] . "] " . $row['clientname'] . "</option>";
                }
            }
            echo "</select>";
            echo "</td></form>";
            if (isset($GLOBALS['campaignid']) && $GLOBALS['campaignid'] != '') {
                echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
                echo "<input type='hidden' name='zoneid' value='" . $GLOBALS['zoneid'] . "'>";
                echo "<input type='hidden' name='affiliateid' value='" . $GLOBALS['affiliateid'] . "'>";
                echo "<input type='hidden' name='clientid' value='" . $GLOBALS['clientid'] . "'>";
                echo "<input type='hidden' name='campaignid' value='" . $GLOBALS['campaignid'] . "'>";
                echo "<input type='hidden' name='zonetype' value='" . phpAds_ZoneBanners . "'>";
                echo "<input type='hidden' name='action' value='toggle'>";
                echo "<td>&nbsp;&nbsp;<img src='images/caret-r.gif' align='absmiddle'>&nbsp;&nbsp;";
                echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
                echo "<select name='bannerid' tabindex='" . $tabindex++ . "'>";
                // Fetch all banners which can be linked
                $query = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tbannerid,\n\t\t\t\t\t\tclientid,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\tactive,\n\t\t\t\t\t\tstoragetype\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tclientid = " . $GLOBALS['campaignid'] . "\n\t\t\t\t";
                if ($delivery != phpAds_ZoneText) {
                    if ($width != -1 && $height != -1) {
                        $query .= "AND width = {$width} AND height = {$height}";
                    } elseif ($width != -1) {
                        $query .= "AND width = {$width}";
                    } elseif ($height != -1) {
                        $query .= "AND height = {$height}";
                    }
                } else {
                    $query .= "AND contenttype = 'txt'";
                }
                $query .= "\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\tbannerid";
                $res = phpAds_dbQuery($query);
                while ($row = phpAds_dbFetchArray($res)) {
                    if (!isset($bannerids[$row['bannerid']]) || $bannerids[$row['bannerid']] != true) {
                        $name = $strUntitled;
                        if (isset($row['alt']) && $row['alt'] != '') {
                            $name = $row['alt'];
                        }
                        if (isset($row['description']) && $row['description'] != '') {
                            $name = $row['description'];
                        }
                        echo "<option value='" . $row['bannerid'] . "'>[id" . $row['bannerid'] . "] " . $name . "</option>";
                    }
                }
                echo "</select>";
                echo "&nbsp;<input type='image' src='images/" . $GLOBALS['phpAds_TextDirection'] . "/go_blue.gif' border='0' tabindex='" . $tabindex++ . "'>";
                echo "</td></form>";
            }
        }
        echo "</tr></table>";
        echo "<br><br>";
    }
    // Header
    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'>&nbsp;</td>";
    echo "</tr>";
    echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
    $i = 0;
    $checkedall = true;
    if (!$compact && phpAds_dbNumRows($res) == 0) {
        echo "<tr bgcolor='#F6F6F6'><td colspan='3' height='25'>&nbsp;&nbsp;" . $strNoBannersToLink . "</td></tr>";
    } else {
        foreach (array_keys($campaigns) as $ckey) {
            $campaign = $campaigns[$ckey];
            if (isset($campaign['banners']) && is_array($campaign['banners']) && count($campaign['banners'])) {
                $banners = $campaign['banners'];
                $activebanners = 0;
                foreach (array_keys($banners) as $bkey) {
                    $banner = $banners[$bkey];
                    $linkedrow = isset($bannerids[$banner['bannerid']]) && $bannerids[$banner['bannerid']] == true;
                    if ($compact) {
                        $showrow = $linkedrow;
                    } else {
                        $showrow = $hideinactive == false || $hideinactive == true && ($banner['active'] == 't' && $campaign['active'] == 't' || $linkedrow);
                    }
                    if ($showrow) {
                        $activebanners++;
                    }
                }
                if ($showcampaigns && $activebanners) {
                    if ($i > 0) {
                        echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
                    }
                    echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">";
                    // Begin row
                    echo "<td height='25'>";
                    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                    if (!$compact) {
                        echo "&nbsp;&nbsp;";
                    }
                    // Banner icon
                    if ($campaign['active'] == 't') {
                        echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;";
                    } else {
                        echo "<img src='images/icon-campaign-d.gif' align='absmiddle'>&nbsp;";
                    }
                    // Name
                    if (phpAds_isUser(phpAds_Admin)) {
                        echo "<a href='campaign-edit.php?clientid=" . $campaign['parent'] . "&campaignid=" . $campaign['clientid'] . "'>";
                        echo phpAds_breakString($campaign['clientname'], '60') . "</a>";
                    } else {
                        echo phpAds_breakString($campaign['clientname'], '60');
                    }
                    echo "</td>";
                    // ID
                    echo "<td height='25'>" . $campaign['clientid'] . "</td>";
                    echo "<td>&nbsp;</td></tr>";
                }
                foreach (array_keys($banners) as $bkey) {
                    $banner = $banners[$bkey];
                    $linkedrow = isset($bannerids[$banner['bannerid']]) && $bannerids[$banner['bannerid']] == true;
                    if ($compact) {
                        $showrow = $linkedrow;
                    } else {
                        $showrow = $hideinactive == false || $hideinactive == true && ($banner['active'] == 't' && $campaign['active'] == 't' || $linkedrow);
                    }
                    if (!$compact && !$showrow) {
                        $inactivehidden++;
                    }
                    if ($showrow) {
                        $name = $strUntitled;
                        if (isset($banner['alt']) && $banner['alt'] != '') {
                            $name = $banner['alt'];
                        }
                        if (isset($banner['description']) && $banner['description'] != '') {
                            $name = $banner['description'];
                        }
                        $name = phpAds_breakString($name, '60');
                        if (!$showcampaigns) {
                            if ($i > 0) {
                                echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
                            }
                        } else {
                            echo "<tr height='1'>";
                            echo "<td " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><img src='images/spacer.gif' width='1' height='1'></td>";
                            echo "<td colspan='3' bgcolor='#888888'><img src='images/break-el.gif' height='1' width='100%'></td>";
                            echo "</tr>";
                        }
                        echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">";
                        // Begin row
                        echo "<td height='25'>";
                        echo "&nbsp;&nbsp;";
                        // Show checkbox
                        if (!$compact) {
                            if (isset($bannerids[$banner['bannerid']]) && $bannerids[$banner['bannerid']] == true) {
                                echo "<input type='checkbox' name='bannerid[]' value='" . $banner['bannerid'] . "' checked onclick='reviewall();' tabindex='" . $tabindex++ . "'>";
                            } else {
                                echo "<input type='checkbox' name='bannerid[]' value='" . $banner['bannerid'] . "' onclick='reviewall();' tabindex='" . $tabindex++ . "'>";
                                $checkedall = false;
                            }
                        } else {
                            echo "<a href='zone-include.php?affiliateid=" . $GLOBALS['affiliateid'] . "&zoneid=" . $GLOBALS['zoneid'] . "&bannerid=" . $banner['bannerid'] . "&zonetype=" . phpAds_ZoneBanners . "&action=toggle'>";
                            echo "<img src='images/caret-l.gif' border='0' align='absmiddle'></a>";
                        }
                        // Space
                        echo "&nbsp;&nbsp;";
                        if ($showcampaigns) {
                            echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        }
                        // Banner icon
                        if ($campaign['active'] == 't' && $banner['active'] == 't') {
                            if ($banner['storagetype'] == 'html') {
                                echo "<img src='images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
                            } elseif ($banner['storagetype'] == 'url') {
                                echo "<img src='images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
                            } elseif ($banner['storagetype'] == 'txt') {
                                echo "<img src='images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
                            } else {
                                echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
                            }
                        } else {
                            if ($banner['storagetype'] == 'html') {
                                echo "<img src='images/icon-banner-html-d.gif' align='absmiddle'>&nbsp;";
                            } elseif ($banner['storagetype'] == 'url') {
                                echo "<img src='images/icon-banner-url-d.gif' align='absmiddle'>&nbsp;";
                            } elseif ($banner['storagetype'] == 'txt') {
                                echo "<img src='images/icon-banner-text-d.gif' align='absmiddle'>&nbsp;";
                            } else {
                                echo "<img src='images/icon-banner-stored-d.gif' align='absmiddle'>&nbsp;";
                            }
                        }
                        // Name
                        if (phpAds_isUser(phpAds_Admin)) {
                            echo "<a href='banner-edit.php?clientid=" . $campaign['parent'] . "&campaignid=" . $campaign['clientid'] . "&bannerid=" . $banner['bannerid'] . "'>";
                            echo $name . "</a></td>";
                        } else {
                            echo $name;
                        }
                        // ID
                        echo "<td height='25'>" . $banner['bannerid'] . "</td>";
                        // Show banner
                        if ($banner['contenttype'] == 'txt') {
                            $width = 300;
                            $height = 200;
                        } else {
                            $width = $banner['width'] + 64;
                            $height = $banner['bannertext'] ? $banner['height'] + 90 : $banner['height'] + 64;
                        }
                        echo "<td height='25' align='" . $phpAds_TextAlignRight . "'>";
                        echo "<a href='banner-htmlpreview.php?bannerid=" . $banner['bannerid'] . "' target='_new' ";
                        echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=" . $banner['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>";
                        // End row
                        echo "</tr>";
                        if (!$showcampaigns) {
                            $i++;
                        }
                    }
                }
                if ($showcampaigns && $activebanners) {
                    $i++;
                }
            }
        }
    }
    if (!$compact) {
        echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
        echo "<tr " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><td height='25'>";
        echo "&nbsp;&nbsp;<input type='checkbox' name='checkall' value=''" . ($checkedall == true ? ' checked' : '') . " onclick='toggleall();' tabindex='" . $tabindex++ . "'>";
        echo "&nbsp;&nbsp;<b>" . $strCheckAllNone . "</b>";
        echo "</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
    echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
    echo "<tr><td height='25' align='" . $phpAds_TextAlignLeft . "' nowrap>";
    if (!$compact) {
        if ($hideinactive == true) {
            echo "&nbsp;&nbsp;<img src='images/icon-activate.gif' align='absmiddle' border='0'>";
            echo "&nbsp;<a href='zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&zonetype=" . phpAds_ZoneBanners . "&hideinactive=0'>" . $strShowAll . "</a>";
            echo "&nbsp;&nbsp;|&nbsp;&nbsp;" . $inactivehidden . " " . $strInactiveBannersHidden;
        } else {
            echo "&nbsp;&nbsp;<img src='images/icon-hideinactivate.gif' align='absmiddle' border='0'>";
            echo "&nbsp;<a href='zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&zonetype=" . phpAds_ZoneBanners . "&hideinactive=1'>" . $strHideInactiveBanners . "</a>";
        }
    }
    echo "</td><td colspan='2' align='" . $phpAds_TextAlignRight . "' nowrap>";
    if ($showcampaigns == true) {
        echo "&nbsp;&nbsp;<img src='images/icon-campaign-d.gif' align='absmiddle' border='0'>";
        echo "&nbsp;<a href='zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&zonetype=" . phpAds_ZoneBanners . "&showcampaigns=0'>" . $strHideParentCampaigns . "</a>";
    } else {
        echo "&nbsp;&nbsp;<img src='images/icon-campaign.gif' align='absmiddle' border='0'>";
        echo "&nbsp;<a href='zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&zonetype=" . phpAds_ZoneBanners . "&showcampaigns=1'>" . $strShowParentCampaigns . "</a>";
    }
    echo "&nbsp;&nbsp;</td></tr>";
    echo "</table>";
    echo "<br><br>";
    echo "<br><br>";
    if (!$compact) {
        echo "<input type='submit' name='submit' value='{$strSaveChanges}' tabindex='" . $tabindex++ . "'>";
        echo "</form>";
    }
}
    phpAds_ShowSections(array("5.1", "5.3", "5.4", "5.2", "5.5"));
} elseif (phpAds_isUser(phpAds_Agency)) {
    phpAds_ShowSections(array("5.1"));
}
phpAds_SettingsSelection("invocation");
/*********************************************************/
/* Cache settings fields and get help HTML Code          */
/*********************************************************/
// Determine delivery cache methods
$delivery_cache_methods['none'] = $strNone;
$delivery_cache_methods['db'] = $strCacheDatabase;
if ($fp = @fopen(phpAds_path . '/cache/available', 'wb')) {
    @fclose($fp);
    @unlink(phpAds_path . '/cache/available');
    $delivery_cache_methods['file'] = $strCacheFiles;
}
if (function_exists('shmop_open')) {
    $delivery_cache_methods['shm'] = $strCacheShmop . " (" . $strExperimental . ")";
}
if (function_exists('shm_attach')) {
    $delivery_cache_methods['sysvshm'] = $strCacheSysvshm . " (" . $strExperimental . ")";
}
$settings = array(array('text' => $strDeliverySettings, 'visible' => phpAds_isUser(phpAds_Admin), 'items' => array(array('type' => 'select', 'name' => 'delivery_caching', 'text' => $strCacheType, 'items' => $delivery_cache_methods), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'acl', 'text' => $strUseAcl), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'use_keywords', 'text' => $strUseKeywords), array('type' => 'checkbox', 'name' => 'con_key', 'text' => $strUseConditionalKeys, 'depends' => 'use_keywords==true'), array('type' => 'checkbox', 'name' => 'mult_key', 'text' => $strUseMultipleKeys, 'depends' => 'use_keywords==true'))), array('text' => $strAllowedInvocationTypes, 'items' => array(array('type' => 'checkbox', 'name' => 'allow_invocation_plain', 'text' => $strAllowRemoteInvocation), array('type' => 'checkbox', 'name' => 'allow_invocation_plain_nocookies', 'text' => $strAllowRemoteInvocationNoCookies), array('type' => 'checkbox', 'name' => 'allow_invocation_js', 'text' => $strAllowRemoteJavascript), array('type' => 'checkbox', 'name' => 'allow_invocation_frame', 'text' => $strAllowRemoteFrames), array('type' => 'checkbox', 'name' => 'allow_invocation_xmlrpc', 'text' => $strAllowRemoteXMLRPC), array('type' => 'checkbox', 'name' => 'allow_invocation_local', 'text' => $strAllowLocalmode), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'allow_invocation_interstitial', 'text' => $strAllowInterstitial), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'allow_invocation_popup', 'text' => $strAllowPopups))), array('text' => $strP3PSettings, 'visible' => phpAds_isUser(phpAds_Admin), 'items' => array(array('type' => 'checkbox', 'name' => 'p3p_policies', 'text' => $strUseP3P), array('type' => 'break'), array('type' => 'text', 'name' => 'p3p_compact_policy', 'text' => $strP3PCompactPolicy, 'size' => 35, 'depends' => 'p3p_policies==true'), array('type' => 'break'), array('type' => 'text', 'name' => 'p3p_policy_location', 'text' => $strP3PPolicyLocation, 'size' => 35, 'depends' => 'p3p_policies==true', 'check' => 'url'))));
/*********************************************************/
/* Main code                                             */
/*********************************************************/
phpAds_ShowSettings($settings, $errormessage);
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
Пример #19
0
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>";
    }
}
$res = phpAds_dbQuery("\n\tSELECT\n\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\tFROM\n\t\t" . $phpAds_config['tbl_adstats'] . "\n\tWHERE\n\t\t(" . implode(' OR ', $bannerids) . ")\n\tGROUP BY\n\t\tday\n\tORDER BY\n\t\tday DESC\n\tLIMIT 7\n") or phpAds_sqlDie();
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext($row['date_formatted'], "stats-campaign-daily-hosts.php?day=" . $row['date'] . "&clientid=" . $clientid . "&campaignid=" . $campaignid, $day == $row['date']);
}
if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) {
    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_PageHeader("2.1.2.1.2");
    echo "<img src='images/icon-advertiser.gif' align='absmiddle'>&nbsp;" . phpAds_getClientName($clientid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getCampaignName($campaignid);
    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><br>";
    phpAds_ShowSections(array("2.1.2.1.1", "2.1.2.1.2"));
}
if (phpAds_isUser(phpAds_Client)) {
    phpAds_PageHeader("1.1.2");
    echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getCampaignName($campaignid);
    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>";
    phpAds_ShowSections(array("1.2.1.1", "1.2.1.2"));
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$lib_hourly_where = "(" . implode(' OR ', $bannerids) . ")";
include "lib-hourly-hosts.inc.php";
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();
Пример #21
0
function phpAds_DelConfirm($msg)
{
    global $phpAds_config;
    if (phpAds_isUser(phpAds_Admin)) {
        if ($phpAds_config['admin_novice']) {
            $str = " onClick=\"return confirm('" . $msg . "')\"";
        } else {
            $str = "";
        }
    } else {
        $str = " onClick=\"return confirm('" . $msg . "')\"";
    }
    return $str;
}
     echo "\t\t\t\t</tr>\n";
 }
 echo "\t\t\t\t<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">\n";
 // Begin row
 echo "\t\t\t\t\t<td height='25'>";
 // Show checkbox
 if (isset($campaign_tracker_row[$tracker['trackerid']])) {
     echo "<input id='trk" . $tracker['trackerid'] . "' type='checkbox' name='trackerids[]' value='" . $tracker['trackerid'] . "' checked onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'>";
 } else {
     echo "<input id='trk" . $tracker['trackerid'] . "' type='checkbox' name='trackerids[]' value='" . $tracker['trackerid'] . "' onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'>";
     $checkedall = false;
 }
 // Campaign icon
 echo "<img src='images/icon-tracker.gif' align='absmiddle'>";
 // Name
 if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) {
     echo "<a href='tracker-edit.php?clientid=" . $tracker['clientid'] . "&trackerid=" . $tracker['trackerid'] . "'>";
     echo phpAds_breakString($tracker['trackername'], '60') . "</a>";
 } else {
     echo phpAds_breakString($tracker['trackername'], '60');
 }
 echo "</td>\n";
 // ID
 echo "\t\t\t\t\t<td height='25'>" . $tracker['trackerid'] . "</td>\n";
 // Log
 if (isset($campaign_tracker_row[$tracker['trackerid']]) && $campaign_tracker_row[$tracker['trackerid']]['logstats'] == 'y') {
     echo "\t\t\t\t\t<td height='25'><input id='logtrk" . $tracker['trackerid'] . "' type='checkbox' name='logids[]' value='" . $tracker['trackerid'] . "' checked onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'></td>\n";
 } else {
     echo "\t\t\t\t\t<td height='25'><input id='logtrk" . $tracker['trackerid'] . "' type='checkbox' name='logids[]' value='" . $tracker['trackerid'] . "' onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'></td>\n";
 }
 $seconds_left = $tracker['clickwindow'];
Пример #23
0
function phpAds_getKeywordsArray()
{
    global $phpAds_config;
    if (phpAds_isUser(phpAds_Admin)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'];
    } elseif (phpAds_isUser(phpAds_Agency)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . phpAds_getUserID();
    } elseif (phpAds_isUser(phpAds_Client)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid=" . phpAds_getUserID();
    }
    $res = phpAds_dbQuery($query);
    while ($row = phpAds_dbFetchArray($res)) {
        $affiliateArray[$row['affiliateid']] = phpAds_buildAffiliateName($row['affiliateid'], $row['name']);
    }
    return $affiliateArray;
}