Beispiel #1
0
function OA_headerNavigation()
{
    $oHeaderModel = buildAdvertiserHeaderModel($GLOBALS['clientid']);
    if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        phpAds_PageHeader("advertiser-access", $oHeaderModel);
        phpAds_ShowSections(array("4.1.2", "4.1.3", "4.1.5", "4.1.5.2"));
    } else {
        $sections = array();
        if (OA_Permission::hasPermission(OA_PERM_BANNER_ACTIVATE) || OA_Permission::hasPermission(OA_PERM_BANNER_EDIT)) {
            $sections[] = '2.2';
        }
        $sections[] = '2.3';
        $sections[] = '2.3.2';
        phpAds_PageHeader('advertiser-access', $oHeaderModel);
        phpAds_ShowSections($sections);
    }
}
$oHeaderModel = MAX_displayWebsiteBreadcrumbs($affiliateid);
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
    // Get other affiliates
    $doAffiliates = OA_Dal::factoryDO('affiliates');
    $doAffiliates->addSessionListOrderBy('affiliate-zones.php');
    $doAffiliates->agencyid = $agencyid;
    $doAffiliates->find();
    while ($doAffiliates->fetch() && ($row = $doAffiliates->toArray())) {
        phpAds_PageContext(MAX_buildName($row['affiliateid'], $row['name']), "affiliate-invocation.php?affiliateid=" . $row['affiliateid'], $affiliateid == $row['affiliateid']);
    }
    addWebsitePageTools($affiliateid);
    phpAds_PageHeader("4.2.5", $oHeaderModel);
} else {
    $sections = array();
    $sections[] = "2.1";
    if (OA_Permission::hasPermission(OA_PERM_ZONE_INVOCATION)) {
        $sections[] = "2.2";
    }
    phpAds_PageHeader('2.2', $oHeaderModel);
    phpAds_ShowSections($sections);
}
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/max/Admin/Invocation/Publisher.php';
$maxInvocation = new MAX_Admin_Invocation_Publisher();
$maxInvocation->placeInvocationForm();
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageFooter();
    $res = phpAds_dbQuery($query) or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        $extra .= "\t\t\t\t\t<option value='" . $row['clientid'] . "'>" . phpAds_buildName($row['clientid'], $row['clientname']) . "</option>\n";
    }
    $extra .= "\t\t\t\t</select>&nbsp;\n";
    $extra .= "\t\t\t\t<input type='image' src='images/" . $phpAds_TextDirection . "/go_blue.gif'><br>\n";
    $extra .= "\t\t\t\t<img src='images/break.gif' height='1' width='160' vspace='4'><br>\n";
    $extra .= "\t\t\t\t<img src='images/icon-recycle.gif' align='absmiddle'>\n";
    $extra .= "\t\t\t\t<a href='tracker-delete.php?clientid={$clientid}&trackerid={$trackerid}&returnurl=advertiser-trackers.php'" . phpAds_DelConfirm($strConfirmDeleteTracker) . ">{$strDelete}</a><br>\n";
    $extra .= "\t\t\t\t</form>\n";
    phpAds_PageHeader("4.1.4.3", $extra);
    echo "\t\t\t\t<img src='images/icon-advertiser.gif' align='absmiddle'>&nbsp;" . phpAds_getClientName($clientid) . "\n";
    echo "\t\t\t\t<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>\n";
    echo "\t\t\t\t<img src='images/icon-tracker.gif' align='absmiddle'>\n";
    echo "\t\t\t\t<b>" . phpAds_getTrackerName($trackerid) . "</b><br><br><br>\n";
    phpAds_ShowSections(array("4.1.4.2", "4.1.4.3", "4.1.4.5", "4.1.4.4"));
}
if (isset($trackerid) && $trackerid != '') {
    $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();
    if (phpAds_dbNumRows($res)) {
        $tracker = phpAds_dbFetchArray($res);
    }
}
$tabindex = 1;
// Header
echo "\t\t\t\t<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>\n";
echo "\t\t\t\t<tr height='25'>\n";
echo "\t\t\t\t\t<td height='25' width='40%'>\n";
echo "\t\t\t\t\t\t<b>&nbsp;&nbsp;<a href='tracker-campaigns.php?clientid=" . $clientid . "&trackerid=" . $trackerid . "&listorder=name'>" . $GLOBALS['strName'] . "</a>";
if ($listorder == "name" || $listorder == "") {
    if ($orderdirection == "" || $orderdirection == "down") {
    }
    if (!count($errormessage)) {
        phpAds_SettingsWriteFlush();
        header("Location: settings-host.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("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 . ")";
Beispiel #5
0
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/config.php';
// Register input variables
// TODO: This variable has been added to demonstrate that clicking on
// links from error messages could bring the already entered e-mail address
// to the new form. Feel free to keep it or remove, depending on the
// implementation strategy.
phpAds_registerGlobalUnslashed('email');
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageHeader("4.1.3.4.7.2");
// TODO: The path here should probably start with the advertiser's data
// Not sure if we need to include the campaign and banner in the path though.
// We'll need to clarify this with the Product team.
echo "<img src='" . OX::assetPath() . "/images/icon-affiliate.gif' align='absmiddle'>&nbsp;<b>Create AdSense Account</b><br /><br /><br />";
phpAds_ShowSections(array("4.1.3.4.7.2"));
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
$oTpl = new OA_Admin_Template('adsense-create.html');
$oTpl->assign('fields', array(array('title' => 'Email address for AdSense Account', 'fields' => array(array('name' => 'email', 'label' => 'Email', 'value' => '', 'id' => 'adsenseemail', 'title' => 'Provide valid email', 'clientValid' => 'required:true,email:true'))), array('title' => 'Name for the AdSense Account in Openads', 'fields' => array(array('name' => 'name', 'label' => 'Name for the AdSense Account in Openads', 'value' => '', 'id' => 'accountname', 'title' => 'Provide name in Openads', 'clientValid' => 'required:true')))));
//var_dump($oTpl);
//die();
$oTpl->display();
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageFooter();
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-statistics.inc.php';
// Register input variables
phpAds_registerGlobal('expand', 'collapse', 'hideinactive', 'listorder', 'orderdirection');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN);
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
addPageTools();
phpAds_PageHeader("4.1");
phpAds_ShowSections(array("4.1", "4.3", "4.4"));
/*-------------------------------------------------------*/
/* Get preferences                                       */
/*-------------------------------------------------------*/
if (!isset($hideinactive)) {
    if (isset($session['prefs']['agency-index.php']['hideinactive'])) {
        $hideinactive = $session['prefs']['agency-index.php']['hideinactive'];
    } else {
        $pref =& $GLOBALS['_MAX']['PREF'];
        $hideinactive = $pref['ui_hide_inactive'] == true;
    }
}
if (!isset($listorder)) {
    if (isset($session['prefs']['agency-index.php']['listorder'])) {
        $listorder = $session['prefs']['agency-index.php']['listorder'];
    } else {
Beispiel #7
0
function OA_headerUserNavigation()
{
    phpAds_PageHeader("4.4.2");
    phpAds_ShowSections(array("4.1", "4.3", "4.4", "4.4.2"));
}
    }
    $res = phpAds_dbQuery($query) or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        $extra .= "\t\t\t\t\t<option value='" . $row['clientid'] . "'>" . phpAds_buildName($row['clientid'], $row['clientname']) . "</option>\n";
    }
    $extra .= "\t\t\t\t</select>&nbsp;\n";
    $extra .= "\t\t\t\t<input type='image' src='images/" . $phpAds_TextDirection . "/go_blue.gif'><br>\n";
    $extra .= "\t\t\t\t<img src='images/break.gif' height='1' width='160' vspace='4'><br>\n";
    $extra .= "\t\t\t\t<img src='images/icon-recycle.gif' align='absmiddle'>\n";
    $extra .= "\t\t\t\t<a href='campaign-delete.php?clientid={$clientid}&campaignid={$campaignid}&returnurl=advertiser-campaigns.php'" . phpAds_DelConfirm($strConfirmDeleteTracker) . ">{$strDelete}</a><br>\n";
    $extra .= "\t\t\t\t</form>\n";
    phpAds_PageHeader("4.1.3.5", $extra);
    echo "<img src='images/icon-advertiser.gif' align='absmiddle'>&nbsp;" . phpAds_getParentClientName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>";
    phpAds_ShowSections(array("4.1.3.2", "4.1.3.3", "4.1.3.4", "4.1.3.5"));
}
if (isset($campaignid) && $campaignid != '') {
    $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie();
    if (phpAds_dbNumRows($res)) {
        $campaign = phpAds_dbFetchArray($res);
    }
}
$tabindex = 1;
// Header
echo "\t\t\t\t<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>\n";
echo "\t\t\t\t<tr height='25'>\n";
echo "\t\t\t\t\t<td height='25' width='40%'>\n";
echo "\t\t\t\t\t\t<b>&nbsp;&nbsp;<a href='campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&listorder=name'>" . $GLOBALS['strName'] . "</a>";
if ($listorder == "name" || $listorder == "") {
    if ($orderdirection == "" || $orderdirection == "down") {
    $period = '';
}
$tabindex = 1;
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (phpAds_isUser(phpAds_Admin)) {
    $extra = "<br><br><br>";
    $extra .= "<b>{$strMaintenance}</b><br>";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
    $extra .= "<a href='stats-reset.php?all=true'" . phpAds_DelConfirm($strConfirmResetStats) . ">";
    $extra .= "<img src='images/" . $phpAds_TextDirection . "/icon-undo.gif' align='absmiddle' border='0'>&nbsp;{$strResetStats}</a>";
    $extra .= "<br><br>";
}
phpAds_PageHeader("2.1", $extra);
phpAds_ShowSections(array("2.1", "2.4", "2.2", "2.5"));
/*********************************************************/
/* Get preferences                                       */
/*********************************************************/
if (!isset($hideinactive)) {
    if (isset($Session['prefs']['stats-global-advertiser.php']['hideinactive'])) {
        $hideinactive = $Session['prefs']['stats-global-advertiser.php']['hideinactive'];
    } else {
        $hideinactive = $phpAds_config['gui_hide_inactive'] == 't';
    }
}
if (!isset($listorder)) {
    if (isset($Session['prefs']['stats-global-advertiser.php']['listorder'])) {
        $listorder = $Session['prefs']['stats-global-advertiser.php']['listorder'];
    } else {
        $listorder = '';
Beispiel #10
0
function MAX_displayNavigationZone($pageName, $aOtherPublishers, $aOtherZones, $aEntities)
{
    global $phpAds_TextDirection;
    $websiteId = $aEntities['affiliateid'];
    $zoneId = $aEntities['zoneid'];
    $entityString = _getEntityString($aEntities);
    $aOtherEntities = $aEntities;
    unset($aOtherEntities['zoneid']);
    $otherEntityString = _getEntityString($aOtherEntities);
    $aPublisher = $aOtherPublishers[$websiteId];
    $publisherName = MAX_buildName($websiteId, $aPublisher['name']);
    $zoneName = empty($zoneId) ? $GLOBALS['strUntitled'] : MAX_buildName($zoneId, $aOtherZones[$zoneId]['name']);
    if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        $tabSections = array('4.2.3.2', '4.2.3.6', '4.2.3.3', '4.2.3.4', '4.2.3.5');
        // Determine which tab is highlighted
        switch ($pageName) {
            case 'zone-edit.php':
                if (empty($zoneId)) {
                    $tabValue = 'zone-edit_new';
                } else {
                    $tabValue = 'zone-edit';
                }
                break;
            default:
                $tabSections = basename($pageName);
                break;
        }
    } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
        $tabSections = array();
        if (OA_Permission::hasPermission(OA_PERM_ZONE_EDIT)) {
            $tabSections[] = '2.1.1';
        }
        if (OA_Permission::hasPermission(OA_PERM_ZONE_LINK)) {
            $tabSections[] = '2.1.2';
        }
        $tabSections[] = '2.1.3';
        if (OA_Permission::hasPermission(OA_PERM_ZONE_INVOCATION)) {
            $tabSections[] = '2.1.4';
        }
        switch ($pageName) {
            case 'zone-edit.php':
                $tabValue = 'zone-edit';
                if (empty($zoneId)) {
                    $tabValue = 'zone-edit_new';
                }
                break;
            case 'zone-include.php':
                $tabValue = '2.1.2';
                break;
            case 'zone-probability.php':
                $tabValue = '2.1.3';
                break;
            case 'zone-invocation.php':
                $tabValue = '2.1.4';
                break;
        }
    }
    // Sort the zones by name...
    require_once MAX_PATH . '/lib/max/other/stats.php';
    $publisherEditUrl = "affiliate-edit.php?affiliateid={$websiteId}";
    if (!OA_Permission::isAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER)) {
        $publisherEditUrl = "affiliate-zones.php?affiliateid={$websiteId}";
    }
    $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder();
    $oHeaderModel = $builder->buildEntityHeader(array(array("name" => $publisherName, "url" => $publisherEditUrl), array("name" => empty($zoneId) ? '' : $zoneName)), "zone", empty($zoneId));
    if (!empty($zoneId)) {
        addZonePageTools($websiteId, $zoneId, $aOtherPublishers, $aEntities);
    }
    phpAds_PageHeader($tabValue, $oHeaderModel);
    phpAds_ShowSections($tabSections);
}
        phpAds_PageShortcut($strBannerHistory, 'stats-banner-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-statistics.gif');
        phpAds_PageHeader("4.1.3.4.5");
        echo "<img src='images/icon-client.gif' align='absmiddle'>&nbsp;" . phpAds_getParentName($campaignid);
        echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getClientName($campaignid);
        echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . "</b><br><br>";
        echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>";
        phpAds_ShowSections(array("4.1.3.4.5"));
    } else {
        phpAds_PageHeader("1.2.2.3");
        echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getClientName($campaignid);
        echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getBannerName($bannerid) . "</b><br><br>";
        echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>";
        phpAds_ShowSections(array("1.2.2.3"));
    }
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t\t") or phpAds_sqlDie();
    $row = phpAds_dbFetchArray($res);
    if ($row['contenttype'] == 'swf') {
        if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') {
            $swf_file = phpAds_ImageRetrieve($row['storagetype'], $row['filename']);
        }
    } else {
        // Banner is not a flash banner, return to banner-edit.php
        header("Location: banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $bannerid);
        exit;
    }
} else {
    // Banner does not exist, return to banner-edit.php
    header("Location: banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid);
Beispiel #12
0
 /**
  * A private method to do part of the work of the
  * {@link OA_Admin_Statistics_Common::output()} method.
  *
  * @access private
  * @param array $aElements An optional array of output elements to display.
  */
 function _output($aElements = array())
 {
     global $graphFilter;
     // Prepare the Flexy output object
     $oOutput = new HTML_Template_Flexy(array('templateDir' => $this->templateDir, 'compileDir' => MAX_PATH . '/var/templates_compiled'));
     // Add global variables for backwards compatibility
     if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $GLOBALS['clientid'] = OA_Permission::getEntityId();
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $GLOBALS['affiliateid'] = OA_Permission::getEntityId();
     }
     // Add the current page's entity/breakdown values to the page
     // parameters before generating this page's URI
     $this->aPageParams['entity'] = $this->entity;
     $this->aPageParams['breakdown'] = $this->breakdown;
     // Generate URI used to add other parameters
     $this->_generatePageURI();
     $this->assetPath = OX::assetPath();
     phpAds_PageHeader($this->pageId, $this->getHeaderModel());
     // Welcome text
     if (!empty($this->welcomeText)) {
         echo "<br/>";
         echo $this->welcomeText;
         echo "<br/><br/><br/>";
     }
     // Show the page sections
     phpAds_ShowSections($this->aPageSections, $this->aPageParams, $openNewTable = false);
     $graphVals = $graphFilter;
     // Set columns shown by default
     if (!is_array($graphVals)) {
         if (isset($this->aColumns['sum_views'])) {
             $graphVals[] = 'sum_views';
         }
         if (isset($this->aColumns['sum_clicks'])) {
             $graphVals[] = 'sum_clicks';
         }
     }
     // Prepare the data required for displaying graphs
     $graphFilterArray = $graphVals;
     $imageFormat = null;
     if (!extension_loaded('gd')) {
         $this->aGraphData['noGraph'] = true;
     } else {
         $imgPath = rtrim(MAX::constructURL(MAX_URL_IMAGE), '/');
         if (!function_exists('imagecreate')) {
             $this->aGraphData['noGraph'] = $GLOBALS['strGDnotEnabled'];
         } else {
             $tmpUrl = MAX::constructURL(MAX_URL_ADMIN) . 'stats-showgraph.php?' . $_SERVER['QUERY_STRING'];
             if (is_array($graphFilterArray)) {
                 foreach ($graphFilterArray as $k => $v) {
                     $tmpUrl .= '&graphFields[]=' . $v;
                 }
             }
         }
         $formSubmitLink = explode("/", $_SERVER['REQUEST_URI']);
         $formSubmitLink = $formSubmitLink[count($formSubmitLink) - 1];
         $this->aGraphData['imgPath'] = $imgPath;
         $this->aGraphData['tmpUrl'] = $tmpUrl;
         $this->aGraphData['queryString'] = $_SERVER['QUERY_STRING'];
         $this->aGraphData['formSubmitLink'] = $formSubmitLink;
     }
     // Set the Flexy tags to open/close Javascript
     $this->scriptOpen = "\n<script type=\"text/javascript\"> <!--\n";
     $this->scriptClose = "\n//--> </script>\n";
     // Set whether to automatically display the Graph div, will return true if user has just changed the 'graphFields' value
     $this->autoShowGraph = strpos($_SERVER['QUERY_STRING'], 'graphFields');
     // Set the language vars for statistics display
     $this->strShowGraphOfStatistics = $GLOBALS['strShowGraphOfStatistics'];
     $this->strExportStatisticsToExcel = $GLOBALS['strExportStatisticsToExcel'];
     // Set-up Flexy form for displaying graph
     $aElements['graphFilter[]'] = new HTML_Template_Flexy_Element();
     $aElements['graphFilter[]']->setValue($graphVals);
     if ($this->_isEmptyResultArray()) {
         $this->disableGraph = true;
     }
     // Display page content
     $oOutput->compile($this->template);
     $oOutput->outputObject($this, $aElements);
     $this->_savePrefs();
     phpAds_PageFooter();
 }
        echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>";
        phpAds_ShowSections($sections);
    }
} else {
    if (phpAds_isUser(phpAds_Admin)) {
        phpAds_PageHeader("4.2.3.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;<b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>";
        phpAds_ShowSections(array("4.2.3.1"));
    } else {
        phpAds_PageHeader("2.1.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;<b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>";
        phpAds_ShowSections(array("2.1.1"));
    }
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
if (isset($zoneid) && $zoneid != '') {
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie();
    if (phpAds_dbNumRows($res)) {
        $zone = phpAds_dbFetchArray($res);
    }
    if ($zone['width'] == -1) {
        $zone['width'] = '*';
    }
    if ($zone['height'] == -1) {
        $zone['height'] = '*';
    $navorder = '';
}
if (isset($Session['prefs']['client-index.php']['orderdirection'])) {
    $navdirection = $Session['prefs']['client-index.php']['orderdirection'];
} else {
    $navdirection = '';
}
// Get other clients
$res = phpAds_dbQuery("\n\tSELECT\n\t\t*\n\tFROM\n\t\t" . $phpAds_config['tbl_clients'] . "\n\tWHERE\n\t\tparent = 0\n\t" . phpAds_getListOrder($navorder, $navdirection) . "\n") or phpAds_sqlDie();
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "client-campaigns.php?clientid=" . $row['clientid'], $clientid == $row['clientid']);
}
phpAds_PageShortcut($strClientHistory, 'stats-client-history.php?clientid=' . $clientid, 'images/icon-statistics.gif');
phpAds_PageHeader("4.1.3");
echo "<img src='images/icon-client.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getClientName($clientid) . "</b><br><br><br>";
phpAds_ShowSections(array("4.1.2", "4.1.3"));
/*********************************************************/
/* Get preferences                                       */
/*********************************************************/
if (!isset($hideinactive)) {
    if (isset($Session['prefs']['client-campaigns.php'][$clientid]['hideinactive'])) {
        $hideinactive = $Session['prefs']['client-campaigns.php'][$clientid]['hideinactive'];
    } else {
        $hideinactive = $phpAds_config['gui_hide_inactive'] == 't';
    }
}
if (!isset($listorder)) {
    if (isset($Session['prefs']['client-campaigns.php'][$clientid]['listorder'])) {
        $listorder = $Session['prefs']['client-campaigns.php'][$clientid]['listorder'];
    } else {
        $listorder = '';
$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();
    }
    phpAds_SettingsWriteAdd('type_html_auto', isset($type_html_auto));
    phpAds_SettingsWriteAdd('type_html_php', isset($type_html_php));
    if (!count($errormessage)) {
        if (phpAds_SettingsWriteFlush()) {
            header("Location: settings-admin.php");
            exit;
        }
    }
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PrepareHelp();
phpAds_PageHeader("5.1");
phpAds_ShowSections(array("5.1", "5.3", "5.4", "5.2"));
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'])) {
        // Decode URL parts
        $ftpserver['user'] = urldecode($ftpserver['user']);
        $ftpserver['pass'] = urldecode($ftpserver['pass']);
        $ftpserver['path'] = urldecode($ftpserver['path']);
        $ftpserver['path'] = preg_replace('#^/#', '', $ftpserver['path']);
        $ftpserver['path'] = preg_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'];
        addWebsitePageTools($affiliateid);
        phpAds_PageHeader("4.2.7", $oHeaderModel);
        phpAds_ShowSections(array("4.2.2", "4.2.3", "4.2.4", "4.2.5", "4.2.7"));
    } else {
        addPageTools($affiliateid);
        phpAds_PageHeader('2.3', $oHeaderModel);
        $sections = array('2.1');
        if (OA_Permission::hasPermission(OA_PERM_ZONE_INVOCATION)) {
            $sections[] = '2.2';
        }
        $sections[] = '2.3';
        phpAds_ShowSections($sections);
    }
} else {
    phpAds_PageHeader("4.2.1", $oHeaderModel);
    phpAds_ShowSections(array("4.2.1"));
}
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
$oTpl = new OA_Admin_Template('affiliate-access.html');
// Ensure that any template variables for the authentication plugin are set
$oPlugin = OA_Auth::staticGetAuthPlugin();
$oPlugin->setTemplateVariables($oTpl);
$oTpl->assign('infomessage', OA_Session::getMessage());
$oTpl->assign('entityIdName', 'affiliateid');
$oTpl->assign('entityIdValue', $affiliateid);
$oTpl->assign('editPage', 'affiliate-user.php');
$oTpl->assign('unlinkPage', 'affiliate-user-unlink.php');
$doUsers = OA_Dal::factoryDO('users');
    phpAds_ShowSections(array("4.1.3.2", "4.1.3.3", "4.1.3.4"));
} else {
    if (isset($move) && $move == 't') {
        // Convert client to campaign
        phpAds_PageHeader("4.1.3.2");
        echo "<img src='images/icon-client.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;<b>" . $strUntitled . "</b><br><br><br>";
        phpAds_ShowSections(array("4.1.3.2"));
    } else {
        // New campaign
        phpAds_PageHeader("4.1.3.1");
        echo "<img src='images/icon-client.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;<b>" . $strUntitled . "</b><br><br><br>";
        phpAds_ShowSections(array("4.1.3.1"));
    }
}
if ($campaignid != "" || isset($move) && $move == 't') {
    // Edit or Convert
    // Fetch exisiting settings
    // Parent setting for converting, campaign settings for editing
    if ($campaignid != "") {
        $ID = $campaignid;
    }
    if (isset($move) && $move == 't') {
        if (isset($clientid) && $clientid != "") {
            $ID = $clientid;
        }
    }
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*,\n\t\t\tto_days(expire) as expire_day,\n\t\t\tto_days(curdate()) as cur_date,\n\t\t\tUNIX_TIMESTAMP(expire) as timestamp,\n\t\t\tDATE_FORMAT(expire, '{$date_format}') as expire_f,\n\t\t\tdayofmonth(expire) as expire_dayofmonth,\n\t\t\tmonth(expire) as expire_month,\n\t\t\tyear(expire) as expire_year,\n\t\t\tDATE_FORMAT(activate, '{$date_format}') as activate_f,\n\t\t\tdayofmonth(activate) as activate_dayofmonth,\n\t\t\tmonth(activate) as activate_month,\n\t\t\tyear(activate) as activate_year\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tclientid = {$ID}\n\t\t") or phpAds_sqlDie();
        phpAds_PageHeader("1.2.3");
        echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getClientName($campaignid) . "</b><br><br><br>";
        phpAds_ShowSections(array("1.2.1", "1.2.2", "1.2.3"));
    } else {
        phpAds_PageHeader("1");
        phpAds_Die($strAccessDenied, $strNotAdmin);
    }
}
if (phpAds_isUser(phpAds_Admin)) {
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tparent = " . $clientid . "\n\t\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t") or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['clientid'], $campaignid == $row['clientid']);
    }
    phpAds_PageShortcut($strClientProperties, 'client-edit.php?clientid=' . $clientid, 'images/icon-client.gif');
    phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-campaign.gif');
    phpAds_PageHeader("2.1.2.3");
    echo "<img src='images/icon-client.gif' align='absmiddle'>&nbsp;" . phpAds_getParentName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getClientName($campaignid) . "</b><br><br><br>";
    phpAds_ShowSections(array("2.1.2.1", "2.1.2.2", "2.1.2.3"));
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$lib_targetstats_params = array('clientid' => $clientid, 'campaignid' => $campaignid);
$lib_targetstats_where = "clientid = '" . $campaignid . "'";
include "lib-targetstats.inc.php";
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
phpAds_PageFooter();