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'];
 if (isset($campaign_tracker_row[$tracker['trackerid']])) {
     $seconds_left = $campaign_tracker_row[$tracker['trackerid']]['clickwindow'];
 }
 $clickwindowday = floor($seconds_left / (60 * 60 * 24));
 } else {
     echo "<input id='cmp" . $campaign['campaignid'] . "' type='checkbox' name='campaignids[]' value='" . $campaign['campaignid'] . "' onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'>";
     $checkedall = false;
 }
 // Campaign icon
 if ($campaign['active'] == 't') {
     echo "<img src='images/icon-campaign.gif' align='absmiddle'>";
 } else {
     echo "<img src='images/icon-campaign-d.gif' align='absmiddle'>";
 }
 // Name
 if (phpAds_isUser(phpAds_Admin)) {
     echo "<a href='campaign-edit.php?clientid=" . $campaign['clientid'] . "&campaignid=" . $campaign['campaignid'] . "'>";
     echo phpAds_breakString($campaign['campaignname'], '60') . "</a>";
 } else {
     echo phpAds_breakString($campaign['campaignname'], '60');
 }
 echo "</td>\n";
 // ID
 echo "\t\t\t\t\t<td height='25'>" . $campaign['campaignid'] . "</td>\n";
 // Log
 if (isset($campaign_tracker_row[$campaign['campaignid']]) && $campaign_tracker_row[$campaign['campaignid']]['logstats'] == 'y') {
     echo "\t\t\t\t\t<td height='25'><input id='logcmp" . $campaign['campaignid'] . "' type='checkbox' name='logids[]' value='" . $campaign['campaignid'] . "' checked onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'></td>\n";
 } else {
     echo "\t\t\t\t\t<td height='25'><input id='logcmp" . $campaign['campaignid'] . "' type='checkbox' name='logids[]' value='" . $campaign['campaignid'] . "' onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'></td>\n";
 }
 $seconds_left = $default_clickwindow;
 if (isset($campaign_tracker_row[$campaign['campaignid']])) {
     $seconds_left = $campaign_tracker_row[$campaign['campaignid']]['clickwindow'];
 }
 $clickwindowday = floor($seconds_left / (60 * 60 * 24));
function phpAds_buildBannerName($bannerid, $description = '', $alt = '', $limit = 30, $use_html = true)
{
    global $strUntitled;
    $name = '';
    if ($description != "") {
        $name .= $description;
    } elseif ($alt != "") {
        $name .= $alt;
    } else {
        $name .= $strUntitled;
    }
    if (strlen($name) > $limit) {
        $name = phpAds_breakString($name, $limit);
    }
    if ($bannerid != '') {
        $name = $use_html ? "<span dir='" . $GLOBALS['phpAds_TextDirection'] . "'>[id{$bannerid}]</span> " . htmlspecialchars($name) : "[id{$bannerid}] " . htmlspecialchars($name);
    } else {
        $name = htmlspecialchars($name);
    }
    return $name;
}
示例#4
0
 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='" . OX::assetPath() . "/images/icon-tracker.gif' align='absmiddle'>&nbsp;";
 // Name
 if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
     echo "<a href='tracker-edit.php?clientid=" . $tracker['clientid'] . "&trackerid=" . $tracker['trackerid'] . "'>";
     echo htmlspecialchars(phpAds_breakString($tracker['trackername'], '60')) . "</a>";
 } else {
     echo htmlspecialchars(phpAds_breakString($tracker['trackername'], '60'));
 }
 echo "</td>\n";
 // ID
 echo "\t\t\t\t\t<td height='25'>" . $tracker['trackerid'] . "</td>\n";
 // Status
 $statuses = $GLOBALS['_MAX']['STATUSES'];
 $startStatusesIds = array(1, 2, 4);
 echo "\t\t\t\t\t<td height='25'>";
 echo "<select name='statusids[]' id='statustrk" . $tracker['trackerid'] . "' tabindex='" . $tabindex++ . "'>\n";
 if (isset($campaign_tracker_row[$tracker['trackerid']]['status'])) {
     $trackerStatusId = $campaign_tracker_row[$tracker['trackerid']]['status'];
 } else {
     $trackerStatusId = $tracker['status'];
 }
 foreach ($statuses as $statusId => $statusName) {
    echo "</td></tr>";
} else {
    $i = 0;
    for (reset($banners); $bkey = key($banners); next($banners)) {
        if ($i > 0) {
            echo "<tr height='1'><td colspan='5' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
        }
        // Icon & name
        $name = $strUntitled;
        if (isset($banners[$bkey]['alt']) && $banners[$bkey]['alt'] != '') {
            $name = $banners[$bkey]['alt'];
        }
        if (isset($banners[$bkey]['description']) && $banners[$bkey]['description'] != '') {
            $name = $banners[$bkey]['description'];
        }
        $name = phpAds_breakString($name, '30');
        echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><td height='25'>";
        echo "&nbsp;";
        if (!$phpAds_config['gui_show_campaign_preview']) {
            if ($banners[$bkey]['expand'] == '1') {
                echo "<a href='campaign-banners.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&collapse=" . $banners[$bkey]['bannerid'] . "'><img src='images/triangle-d.gif' align='absmiddle' border='0'></a>&nbsp;";
            } else {
                echo "<a href='campaign-banners.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&expand=" . $banners[$bkey]['bannerid'] . "'><img src='images/" . $phpAds_TextDirection . "/triangle-l.gif' align='absmiddle' border='0'></a>&nbsp;";
            }
        } else {
            echo "&nbsp;";
        }
        if ($banners[$bkey]['active'] == 't') {
            if ($banners[$bkey]['storagetype'] == 'html') {
                echo "<img src='images/icon-banner-html.gif' align='absmiddle'>";
            } elseif ($banners[$bkey]['storagetype'] == 'txt') {
示例#6
0
function MAX_getBannerName($description, $alt)
{
    global $strUntitled;
    $name = $strUntitled;
    if (!empty($alt)) {
        $name = $alt;
    }
    if (!empty($description)) {
        $name = $description;
    }
    $name = phpAds_breakString($name, '30');
    return $name;
}
示例#7
0
 } else {
     echo "<input id='cmp" . $campaign['campaignid'] . "' type='checkbox' name='campaignids[]' value='" . $campaign['campaignid'] . "' onclick='phpAds_reviewAll();' tabindex='" . $tabindex++ . "'>";
     $checkedall = false;
 }
 // Campaign icon
 if ($campaign['status'] == OA_ENTITY_STATUS_RUNNING) {
     echo "<img src='" . OX::assetPath() . "/images/icon-campaign.gif' align='absmiddle'>&nbsp;";
 } else {
     echo "<img src='" . OX::assetPath() . "/images/icon-campaign-d.gif' align='absmiddle'>&nbsp;";
 }
 // Name
 if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER)) {
     echo "<a href='campaign-trackers.php?clientid=" . $campaign['clientid'] . "&campaignid=" . $campaign['campaignid'] . "'>";
     echo htmlspecialchars(phpAds_breakString($campaign['campaignname'], '60')) . "</a>";
 } else {
     echo htmlspecialchars(phpAds_breakString($campaign['campaignname'], '60'));
 }
 echo "</td>\n";
 // ID
 echo "\t\t\t\t\t<td height='25'>" . $campaign['campaignid'] . "</td>\n";
 // Status
 $statuses = $GLOBALS['_MAX']['STATUSES'];
 $startStatusesIds = array(1, 2, 4);
 echo "\t\t\t\t\t<td height='25'>";
 echo "<select name='statusids[]' id='statuscmp" . $campaign['campaignid'] . "' tabindex='" . $tabindex++ . "'>\n";
 if (isset($campaign_tracker_row[$campaign['campaignid']])) {
     $trackerStatusId = $campaign_tracker_row[$campaign['campaignid']]['status'];
 } else {
     $trackerStatusId = $defaults['status'];
 }
 foreach ($statuses as $statusId => $statusName) {
            while ($doZones->fetch()) {
                $aZone = $doZones->toArray();
                $aZone['zonename'] = phpAds_breakString($aZone['zonename'], '30');
                $aAffiliate['zones'][] = $aZone;
            }
        }
        $aAffiliates[] = $aAffiliate;
    }
}
if ($zone != false) {
    $dalZones = OA_Dal::factoryDAL('zones');
    $rsZones = $dalZones->getZoneByKeyword($keyword, $agencyId);
    $rsZones->find();
    while ($rsZones->fetch()) {
        $aZone = $rsZones->toArray();
        $aZone['zonename'] = phpAds_breakString($aZone['zonename'], '30');
        $aZones[] = $aZone;
    }
}
$matchesFound = !(empty($aZones) && empty($aAffiliates) && empty($aClients) && empty($aBanners) && empty($aCampaigns));
$oTpl = new OA_Admin_Template('admin-search.html');
$oTpl->assign('matchesFound', $matchesFound);
$oTpl->assign('keyword', $keyword);
$oTpl->assign('compact', $compact);
$oTpl->assign('client', $client);
$oTpl->assign('campaign', $campaign);
$oTpl->assign('banner', $banner);
$oTpl->assign('affiliate', $affiliate);
$oTpl->assign('zone', $zone);
$oTpl->assign('aClients', $aClients);
$oTpl->assign('aCampaigns', $aCampaigns);
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>";
    }
}
function phpAds_buildBannerName($bannerid, $description = '', $alt = '', $limit = 0, $html = true)
{
    global $strUntitled;
    if (!$limit) {
        $limit = 30;
    }
    $name = '';
    if ($description != "") {
        $name .= $description;
    } elseif ($alt != "") {
        // Un-HTML-entitizize ALT field
        $name .= phpAds_UnHTMLentities($alt);
    } else {
        $name .= $strUntitled;
    }
    if (strlen($name) > $limit) {
        $name = phpAds_breakString($name, $limit);
    }
    if ($html) {
        $name = htmlspecialchars($name);
    }
    if ($bannerid != '') {
        if ($html) {
            $name = "<span dir='" . $GLOBALS['phpAds_TextDirection'] . "'>[id{$bannerid}]</span> " . $name;
        } else {
            $name = "[id{$bannerid}] " . $name;
        }
    }
    return $name;
}