/** * Prepare context using the last settings of the statistics day-span * selector, falling back to the parent class function if not applicable * * @param array $aDates An array of dates, indexed by "YYYYMMDD" with * user formatted values, that should be set for * the context links. * @param string $currentDay The currently selected day, in "YYYYMMDD" format. * @param OA_Admin_Statistics_Common $oCaller The calling object, with the * $pageURI parameter set. */ function showContext($aDates, $currentDay, $oCaller) { $pageURI = preg_replace('/day=\\d{8}(&|&)?/', '', $oCaller->pageURI); if (!preg_match('/entity/', $pageURI)) { $pageURI .= 'entity=' . $oCaller->entity . '&'; } if (!preg_match('/breakdown/', $pageURI)) { $pageURI .= 'breakdown=' . $oCaller->breakdown . '&'; } foreach ($aDates as $day => $date_f) { phpAds_PageContext($date_f, $pageURI . 'day=' . str_replace('-', '', $day), $currentDay == $day); } }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get parameters $advertiserId = $this->_getId('advertiser'); $publisherId = $this->_getId('publisher'); $placementId = $this->_getId('placement'); $adId = $this->_getId('ad'); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER); $this->_checkAccess(array('advertiser' => $advertiserId, 'placement' => $placementId, 'ad' => $adId)); // Fetch campaigns $aPublishers = $this->getBannerPublishers($adId, $placementId); // Cross-entity security check if (!isset($aPublishers[$publisherId])) { $this->noStatsAvailable = true; } // Add standard page parameters $this->aPageParams = array('clientid' => $advertiserId, 'affiliateid' => $publisherId, 'campaignid' => $placementId, 'bannerid' => $adId); // Load the period preset and stats breakdown parameters $this->_loadPeriodPresetParam(); $this->_loadStatsBreakdownParam(); // Load $_GET parameters $this->_loadParams(); // HTML Framework if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $this->pageId = '2.1.2.2.2.1'; $this->aPageSections = array($this->pageId); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $this->pageId = '1.2.2.4.1'; $this->aPageSections = array($this->pageId); } // Add breadcrumbs $this->_addBreadcrumbs('banner', $adId); $this->addCrossBreadcrumbs('publisher', $publisherId); // Add context $params = $this->aPageParams; foreach ($aPublishers as $k => $v) { $params['affiliateid'] = $k; phpAds_PageContext(MAX_buildName($k, MAX_getPublisherName($v['name'], null, $v['anonymous'], $k)), $this->_addPageParamsToURI($this->pageName, $params, true), $publisherId == $k); } // Add shortcuts if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $this->_addShortcut($GLOBALS['strClientProperties'], 'advertiser-edit.php?clientid=' . $advertiserId, 'images/icon-advertiser.gif'); } $this->_addShortcut($GLOBALS['strCampaignProperties'], 'campaign-edit.php?clientid=' . $advertiserId . '&campaignid=' . $placementId, 'images/icon-campaign.gif'); $this->_addShortcut($GLOBALS['strBannerProperties'], 'banner-edit.php?clientid=' . $advertiserId . '&campaignid=' . $placementId . '&bannerid=' . $adId, 'images/icon-banner-stored.gif'); $this->_addShortcut($GLOBALS['strModifyBannerAcl'], 'banner-acl.php?clientid=' . $advertiserId . '&campaignid=' . $placementId . '&bannerid=' . $adId, 'images/icon-acl.gif'); // Prepare the data for display by output() method $aParams = array('ad_id' => $adId, 'publisher_id' => $publisherId); $this->prepare($aParams, 'stats.php'); }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get parameters $publisherId = $this->_getId('publisher'); $zoneId = $this->_getId('zone'); $adId = $this->_getId('ad', 0); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_TRAFFICKER); $this->_checkAccess(array('publisher' => $publisherId, 'zone' => $zoneId)); // Cross-entity security check if (!empty($zoneId)) { $aAds = $this->getZoneBanners($zoneId); if (!isset($aAds[$adId])) { $this->noStatsAvailable = true; } } // Add standard page parameters $this->aPageParams = array('affiliateid' => $publisherId, 'zoneid' => $zoneId, 'campaignid' => $aAds[$adId]['placement_id'], 'bannerid' => $adId); // Load the period preset and stats breakdown parameters $this->_loadPeriodPresetParam(); $this->_loadStatsBreakdownParam(); // Load $_GET parameters $this->_loadParams(); // HTML Framework if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $this->pageId = '2.4.2.2.2'; $this->aPageSections = array($this->pageId); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->pageId = '1.2.2.2'; $this->aPageSections = array($this->pageId); } // Add breadcrumbs $this->_addBreadcrumbs('zone', $zoneId); $this->addCrossBreadcrumbs('banner', $adId); // Add context $params = $this->aPageParams; foreach ($aAds as $k => $v) { $params['campaignid'] = $v['placement_id']; $params['bannerid'] = $k; phpAds_PageContext(MAX_buildName($k, MAX_getAdName($v['name'], null, null, $v['anonymous'], $k)), $this->_addPageParamsToURI($this->pageName, $params, true), $adId == $k); } // Add shortcuts if (!OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->_addShortcut($GLOBALS['strAffiliateProperties'], 'affiliate-edit.php?affiliateid=' . $publisherId, 'images/icon-affiliate.gif'); } $this->_addShortcut($GLOBALS['strZoneProperties'], 'zone-edit.php?affiliateid=' . $publisherId . '&zoneid=' . $zoneId, 'images/icon-zone.gif'); // Prepare the data for display by output() method $aParams = array('zone_id' => $zoneId, 'ad_id' => $adId); $this->prepare($aParams, 'stats.php'); }
$listorder = $Session['prefs']['campaign-trackers.php']['listorder']; } else { $listorder = ''; } } if (!isset($orderdirection)) { if (isset($Session['prefs']['campaign-trackers.php']['orderdirection'])) { $orderdirection = $Session['prefs']['campaign-trackers.php']['orderdirection']; } else { $orderdirection = ''; } } // Get other trackers $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection)); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); phpAds_PageShortcut($strCampaignHistory, 'stats-campaign-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-statistics.gif'); $extra = "\t\t\t\t<form action='campaign-modify.php'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='campaignid' value='{$campaignid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='clientid' value='{$clientid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='returnurl' value='campaign-trackers.php'>" . "\n"; $extra .= "\t\t\t\t<br><br>" . "\n"; $extra .= "\t\t\t\t<b>{$strModifyCampaign}</b><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-move-campaign.gif' align='absmiddle'> {$strMoveTo}<br>" . "\n"; $extra .= "\t\t\t\t<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>" . "\n"; $extra .= "\t\t\t\t " . "\n"; $extra .= "\t\t\t\t<select name='moveto' style='width: 110;'>" . "\n";
/* Store preferences */ /*-------------------------------------------------------*/ $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['affiliateid'] = $affiliateid; phpAds_SessionDataStore(); /*-------------------------------------------------------*/ /* HTML framework */ /*-------------------------------------------------------*/ $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 */ /*-------------------------------------------------------*/
$listorder = $Session['prefs']['tracker-campaigns.php']['listorder']; } else { $listorder = ''; } } if (!isset($orderdirection)) { if (isset($Session['prefs']['tracker-campaigns.php']['orderdirection'])) { $orderdirection = $Session['prefs']['tracker-campaigns.php']['orderdirection']; } else { $orderdirection = ''; } } // Get other trackers $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE clientid=" . $clientid . phpAds_getTrackerListOrder($navorder, $navdirection)); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['trackerid'], $row['trackername']), "tracker-campaigns.php?clientid=" . $clientid . "&trackerid=" . $row['trackerid'], $trackerid == $row['trackerid']); } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); //phpAds_PageShortcut($strTrackerHistory, 'stats-tracker-history.php?clientid='.$clientid.'&trackerid='.$trackerid, 'images/icon-statistics.gif'); $extra = "\t\t\t\t<form action='tracker-modify.php'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='trackerid' value='{$trackerid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='clientid' value='{$clientid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='returnurl' value='tracker-campaigns.php'>" . "\n"; $extra .= "\t\t\t\t<br><br>" . "\n"; $extra .= "\t\t\t\t<b>{$strModifyTracker}</b><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-duplicate-tracker.gif' align='absmiddle'> <a href='tracker-modify.php?clientid=" . $clientid . "&trackerid=" . $trackerid . "&duplicate=true&returnurl=tracker-campaigns.php'>{$strDuplicate}</a><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-move-tracker.gif' align='absmiddle'> {$strMoveTo}<br>" . "\n"; $extra .= "\t\t\t\t<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>" . "\n";
/* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { if (isset($Session['prefs']['stats-global-client.php']['listorder'])) { $navorder = $Session['prefs']['stats-global-client.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['stats-global-client.php']['orderdirection'])) { $navdirection = $Session['prefs']['stats-global-client.php']['orderdirection']; } else { $navdirection = ''; } $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\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "stats-client-history.php?clientid=" . $row['clientid'], $clientid == $row['clientid']); } phpAds_PageShortcut($strClientProperties, 'client-edit.php?clientid=' . $clientid, 'images/icon-client.gif'); $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?clientid={$clientid}'" . phpAds_DelConfirm($strConfirmResetClientStats) . ">"; $extra .= "<img src='images/" . $phpAds_TextDirection . "/icon-undo.gif' align='absmiddle' border='0'> {$strResetStats}</a>"; $extra .= "<br><br>"; phpAds_PageHeader("2.1.1", $extra); echo "<img src='images/icon-client.gif' align='absmiddle'> <b>" . phpAds_getClientName($clientid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.1.1", "2.1.2")); } if (phpAds_isUser(phpAds_Client)) { phpAds_PageHeader("1.1"); if ($phpAds_config['client_welcome']) {
phpAds_Die($strAccessDenied, $strNotAdmin); } } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . phpAds_getClientListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE agencyid=" . phpAds_getUserID() . phpAds_getClientListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['clientid'], $row['clientname']), "stats-advertiser-history.php?clientid=" . $row['clientid'], $clientid == $row['clientid']); } phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); 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?clientid={$clientid}'" . phpAds_DelConfirm($strConfirmResetClientStats) . ">"; $extra .= "<img src='images/" . $phpAds_TextDirection . "/icon-undo.gif' align='absmiddle' border='0'> {$strResetStats}</a>"; $extra .= "<br><br>"; } phpAds_PageHeader("2.1.1", $extra); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> <b>" . phpAds_getClientName($clientid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.1.1", "2.1.2")); } if (phpAds_isUser(phpAds_Client)) {
phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } } /*********************************************************/ /* HTML framework */ /*********************************************************/ $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'> " . phpAds_getAffiliateName($affiliateid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-date.gif' align='absmiddle'> <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'> <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")); } /*********************************************************/
$navorder = ''; } if (isset($Session['prefs']['advertiser-index.php']['orderdirection'])) { $navdirection = $Session['prefs']['advertiser-index.php']['orderdirection']; } else { $navdirection = ''; } // Get other advertisers if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT * FROM " . $phpAds_config['tbl_clients'] . phpAds_getClientListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT * FROM " . $phpAds_config['tbl_clients'] . " WHERE agencyid=" . $Session['userid'] . phpAds_getClientListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['clientid'], $row['clientname']), "advertiser-trackers.php?clientid=" . $row['clientid'], $clientid == $row['clientid']); } phpAds_PageShortcut($strClientHistory, 'stats-advertiser-history.php?clientid=' . $clientid, 'images/icon-statistics.gif'); phpAds_PageHeader("4.1.4"); echo "\t\t\t\t<img src='images/icon-advertiser.gif' align='absmiddle'> \n"; echo "\t\t\t\t<b>" . phpAds_getClientName($clientid) . "</b>\n"; echo "\t\t\t\t<br><br><br>\n"; phpAds_ShowSections(array("4.1.2", "4.1.3", "4.1.4")); } /*********************************************************/ /* Main code */ /*********************************************************/ // Get clients & campaign and build the tree $res_trackers = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE clientid=" . $clientid . phpAds_getTrackerListOrder($listorder, $orderdirection)) or phpAds_sqlDie(); if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency) || phpAds_isAllowed(phpAds_AddTracker)) { echo "\t\t\t\t<img src='images/icon-tracker-new.gif' border='0' align='absmiddle'>\n";
// Include required files require "config.php"; require "lib-statistics.inc.php"; require "lib-size.inc.php"; require "lib-zones.inc.php"; require_once 'lib-data-statistics.inc.php'; require_once 'lib-data-campaigns.inc.php'; require_once 'lib-prefs.inc.php'; // Register input variables phpAds_registerGlobal('campaignid', 'clientid', 'collapse', 'expand', 'keep', 'listorder', 'omit', 'orderdirection'); $page = 'stats-campaign-optimise.php'; // BUILD PAGE HEADER if (phpAds_isUser(phpAds_Admin)) { $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid = " . $clientid) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), $page . "?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } 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.5"); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.1.2.1", "2.1.2.2", "2.1.2.3", "2.1.2.4", "2.1.2.5")); } // GET PREFERENCES if (!isset($listorder)) { $listorder = phpAds_getPref($page, 'listorder'); } if (!isset($orderdirection)) { $orderdirection = phpAds_getPref($page, 'orderdirection');
/* */ /* 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"; // Security check phpAds_checkAccess(phpAds_Admin); /*********************************************************/ /* HTML framework */ /*********************************************************/ if ($phpAds_config['compact_stats']) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tGROUP BY\n\t\t\tday\n\t\tORDER BY\n\t\t\tday DESC\n\t\tLIMIT 7\n\t") or phpAds_sqlDie(); } else { $res = phpAds_dbQuery("\n\t\t SELECT\n\t\t\tDATE_FORMAT(t_stamp, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(t_stamp, '{$date_format}') as date_formatted\n\t\t FROM\n\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t GROUP BY\n\t\t\tdate\n\t\t ORDER BY\n\t\t\tdate DESC\n\t\t LIMIT 7\n\t") or phpAds_sqlDie(); } while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext($row['date_formatted'], "stats-global-daily-hosts.php?day=" . $row['date'], $day == $row['date']); } phpAds_PageHeader("2.2.2"); phpAds_ShowSections(array("2.2.1", "2.2.2")); /*********************************************************/ /* Main code */ /*********************************************************/ include "lib-hourly-hosts.inc.php"; /*********************************************************/ /* HTML framework */ /*********************************************************/ phpAds_PageFooter();
/** * A private method that can be inherited and used by children classes to * output the context in the left navigation bar. * * {@uses phpAds_PageContext()} */ function _showContext($type, $current_id = 0) { if ($this->useDailyClass && $type == 'days') { // Use the helper class contect method instead $aArray = array('period_start' => MAX_getStoredValue('period_start', date('Y-m-d')), 'period_end' => MAX_getStoredValue('period_end', date('Y-m-d'))); $aDates = array_reverse($this->oHistory->getDatesArray($aArray, 'day', $this->oStartDate)); $this->oDaily->showContext($aDates, $current_id, $this); } else { $aParams = array(); switch ($type) { case 'advertisers': if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams['agency_id'] = OA_Permission::getEntityId(); } $params = $this->aPageParams; $advertisers = Admin_DA::getAdvertisers($aParams, false); foreach ($advertisers as $advertiser) { $params['clientid'] = $advertiser['advertiser_id']; phpAds_PageContext(MAX_buildName($advertiser['advertiser_id'], $advertiser['name']), $this->_addPageParamsToURI($this->pageName, $params, true), $current_id == $advertiser['advertiser_id']); } } break; case 'campaigns': $aParams['advertiser_id'] = $this->aPageParams['clientid']; $params = $this->aPageParams; $campaigns = Admin_DA::getPlacements($aParams, false); foreach ($campaigns as $campaign) { $params['campaignid'] = $campaign['placement_id']; // mask campaign name if anonymous campaign $campaign['name'] = MAX_getPlacementName($campaign); phpAds_PageContext(MAX_buildName($campaign['placement_id'], $campaign['name']), $this->_addPageParamsToURI($this->pageName, $params, true), $current_id == $campaign['placement_id']); } break; case 'banners': $aParams['placement_id'] = $this->aPageParams['campaignid']; $params = $this->aPageParams; $banners = Admin_DA::getAds($aParams, false); foreach ($banners as $banner) { $params['bannerid'] = $banner['ad_id']; // mask banner name if anonymous campaign $campaign = Admin_DA::getPlacement($banner['placement_id']); $campaignAnonymous = $campaign['anonymous'] == 't' ? true : false; $banner['name'] = MAX_getAdName($banner['name'], null, null, $campaignAnonymous, $banner['ad_id']); phpAds_PageContext(MAX_buildName($banner['ad_id'], $banner['name']), $this->_addPageParamsToURI($this->pageName, $params, true), $current_id == $banner['ad_id']); } break; case 'publishers': if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams['agency_id'] = OA_Permission::getEntityId(); } $params = $this->aPageParams; $campaigns = Admin_DA::getPublishers($aParams, false); foreach ($campaigns as $publisher) { $params['affiliateid'] = $publisher['publisher_id']; phpAds_PageContext(MAX_buildName($publisher['publisher_id'], $publisher['name']), $this->_addPageParamsToURI($this->pageName, $params, true), $current_id == $publisher['publisher_id']); } } break; case 'publisher-campaigns': if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams = array('publisher_id' => $publisherId, 'placement_id' => $placementId, 'include' => array('placement_id'), 'exclude' => array('zone_id')); $aPlacements = array(); foreach (Admin_DA::fromCache('getEntitiesStats', $aParams + $this->aDates) as $v) { $aPlacements[$v['placement_id']] = true; } $params = $this->aPageParams; $campaigns = Admin_DA::getPlacements(array(), false); foreach ($campaigns as $campaign) { if (isset($aPlacements[$campaign['placement_id']])) { $params['campaignid'] = $campaign['placement_id']; phpAds_PageContext(MAX_buildName($campaign['placement_id'], $campaign['name']), $this->_addPageParamsToURI($this->pageName, $params, true), $current_id == $campaign['placement_id']); } } } break; case 'zones': $aParams['publisher_id'] = $this->aPageParams['affiliateid']; $params = $this->aPageParams; $zones = Admin_DA::getZones($aParams, false); foreach ($zones as $zone) { $params['zoneid'] = $zone['zone_id']; phpAds_PageContext(MAX_buildName($zone['zone_id'], $zone['name']), $this->_addPageParamsToURI($this->pageName, $params, true), $current_id == $zone['zone_id']); } break; } } }
phpAds_registerGlobal('period', 'start', 'limit', 'source'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Affiliate); /*********************************************************/ /* Affiliate interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Affiliate)) { $affiliateid = phpAds_getUserID(); } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_affiliates'] . "\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildAffiliateName($row['affiliateid'], $row['name']), "stats-affiliate-history.php?affiliateid=" . $row['affiliateid'], $affiliateid == $row['affiliateid']); } phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif'); phpAds_PageHeader("2.4.1"); echo "<img src='images/icon-affiliate.gif' align='absmiddle'> <b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.4.1", "2.4.2")); } else { phpAds_PageHeader("1.2"); if ($phpAds_config['client_welcome']) { echo "<br><br>"; // Show welcome message if (!empty($phpAds_client_welcome_msg)) { echo $phpAds_client_welcome_msg; } else { include 'templates/welcome-publisher.html'; }
if ($agencyid != '') { if (isset($Session['prefs']['agency-index.php']['listorder'])) { $navorder = $Session['prefs']['agency-index.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['agency-index.php']['orderdirection'])) { $navdirection = $Session['prefs']['agency-index.php']['orderdirection']; } else { $navdirection = ''; } $query = "\tSELECT \n\t\t\t\t\t\t*\n\t\t\t\t\tFROM \n\t\t\t\t\t\t" . $phpAds_config['tbl_agency']; // Get other agencies $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['agencyid'], $row['name']), "agency-edit.php?agencyid=" . $row['agencyid'], $agencyid == $row['agencyid']); } phpAds_PageHeader("5.5.2"); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> <b>" . phpAds_getAgencyName($agencyid) . "</b><br><br><br>"; phpAds_ShowSections(array("5.5.2")); // Do not get this information if the page // is the result of an error message if (!isset($agency)) { $res = phpAds_dbQuery("SELECT * FROM " . $phpAds_config['tbl_agency'] . " WHERE agencyid=" . $agencyid) or phpAds_sqlDie(); if (phpAds_dbNumRows($res)) { $agency = phpAds_dbFetchArray($res); } // Set password to default value if ($agency['password'] != '') { $agency['password'] = '******'; }
if ($clientid != "") { if (phpAds_isUser(phpAds_Admin)) { if (isset($Session['prefs']['client-index.php']['listorder'])) { $navorder = $Session['prefs']['client-index.php']['listorder']; } else { $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\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\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "client-edit.php?clientid=" . $row['clientid'], $clientid == $row['clientid']); } phpAds_PageShortcut($strClientHistory, 'stats-client-history.php?clientid=' . $clientid, 'images/icon-statistics.gif'); phpAds_PageHeader("4.1.2"); echo "<img src='images/icon-client.gif' align='absmiddle'> <b>" . phpAds_getClientName($clientid) . "</b><br><br><br>"; phpAds_ShowSections(array("4.1.2", "4.1.3")); } else { phpAds_PageHeader("2"); } // Do not get this information if the page // is the result of an error message if (!isset($client)) { $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\tclientid = '" . $clientid . "'\n\t\t\t") or phpAds_sqlDie(); if (phpAds_dbNumRows($res)) { $client = phpAds_dbFetchArray($res); }
/* HTML framework */ /*********************************************************/ if (isset($Session['prefs']['affiliate-zones.php']['listorder'])) { $navorder = $Session['prefs']['affiliate-zones.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['affiliate-zones.php']['orderdirection'])) { $navdirection = $Session['prefs']['affiliate-zones.php']['orderdirection']; } else { $navdirection = ''; } // Get other zones $res = phpAds_dbQuery("\n\tSELECT\n\t\t*\n\tFROM\n\t\t" . $phpAds_config['tbl_zones'] . "\n\tWHERE\n\t\taffiliateid=" . $affiliateid . "\n\t\t" . phpAds_getZoneListOrder($navorder, $navdirection) . "\n"); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildZoneName($row['zoneid'], $row['zonename']), "zone-advanced.php?affiliateid=" . $affiliateid . "&zoneid=" . $row['zoneid'], $zoneid == $row['zoneid']); } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif'); phpAds_PageShortcut($strZoneHistory, 'stats-zone-history.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-statistics.gif'); $extra = "<form action='zone-modify.php'>"; $extra .= "<input type='hidden' name='zoneid' value='{$zoneid}'>"; $extra .= "<input type='hidden' name='returnurl' value='zone-advanced.php'>"; $extra .= "<br><br>"; $extra .= "<b>{$strModifyZone}</b><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-duplicate-zone.gif' align='absmiddle'> <a href='zone-modify.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&duplicate=true&returnurl=zone-advanced.php'>{$strDuplicate}</a><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-move-zone.gif' align='absmiddle'> {$strMoveTo}<br>"; $extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>"; $extra .= " ";
} /*********************************************************/ /* HTML framework */ /*********************************************************/ $bannerids = array(); $idresult = phpAds_dbQuery("\n\tSELECT\n\t\tb.bannerid\n\tFROM\n\t\t" . $phpAds_config['tbl_banners'] . " AS b,\n\t\t" . $phpAds_config['tbl_clients'] . " AS c\n\tWHERE\n\t\tc.parent = {$clientid} AND\n\t\tc.clientid = b.clientid\n"); while ($row = phpAds_dbFetchArray($idresult)) { $bannerids[] = "bannerid = " . $row['bannerid']; } if ($phpAds_config['compact_stats']) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\t(" . implode(' OR ', $bannerids) . ")\n\t\tGROUP BY\n\t\t\tday\n\t\tORDER BY\n\t\t\tday DESC\n\t\tLIMIT 7\n\t") or phpAds_sqlDie(); } else { $res = phpAds_dbQuery("\n\t\t SELECT\n\t\t\tDATE_FORMAT(t_stamp, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(t_stamp, '{$date_format}') as date_formatted\n\t\t FROM\n\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t WHERE\n\t\t\t(" . implode(' OR ', $bannerids) . ")\n\t\t GROUP BY\n\t\t\tdate\n\t\t ORDER BY\n\t\t\tdate DESC\n\t\t LIMIT 7\n\t") or phpAds_sqlDie(); } while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext($row['date_formatted'], "stats-client-daily.php?day=" . $row['date'] . "&clientid=" . $clientid, $day == $row['date']); } if (phpAds_isUser(phpAds_Admin)) { phpAds_PageShortcut($strClientProperties, 'client-edit.php?clientid=' . $clientid, 'images/icon-client.gif'); phpAds_PageHeader("2.1.1.1"); echo "<img src='images/icon-client.gif' align='absmiddle'> " . phpAds_getClientName($clientid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-date.gif' align='absmiddle'> <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>"; $sections[] = "2.1.1.1"; if (!$phpAds_config['compact_stats']) { $sections[] = "2.1.1.2"; } phpAds_ShowSections($sections); } if (phpAds_isUser(phpAds_Client)) { phpAds_PageHeader("1.1.1");
/*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { if (isset($Session['prefs']['affiliate-index.php']['listorder'])) { $navorder = $Session['prefs']['affiliate-index.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['affiliate-index.php']['orderdirection'])) { $navdirection = $Session['prefs']['affiliate-index.php']['orderdirection']; } else { $navdirection = ''; } // Get other affiliates $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_affiliates'] . "\n\t\t" . phpAds_getAffiliateListOrder($navorder, $navdirection) . "\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildAffiliateName($row['affiliateid'], $row['name']), "affiliate-zones.php?affiliateid=" . $row['affiliateid'], $affiliateid == $row['affiliateid']); } phpAds_PageShortcut($strAffiliateHistory, 'stats-affiliate-history.php?affiliateid=' . $affiliateid, 'images/icon-statistics.gif'); phpAds_PageHeader("4.2.3"); echo "<img src='images/icon-affiliate.gif' align='absmiddle'> <b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>"; phpAds_ShowSections(array("4.2.2", "4.2.3")); } else { $sections[] = "2.1"; if (phpAds_isAllowed(phpAds_ModifyInfo)) { $sections[] = "2.2"; } phpAds_PageHeader("2.1"); echo "<img src='images/icon-affiliate.gif' align='absmiddle'> <b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>"; phpAds_ShowSections($sections); } /*********************************************************/
$row = phpAds_dbFetchArray($result); if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"]) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if ($phpAds_config['compact_stats']) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\tzoneid = '{$zoneid}'\n\t\tGROUP BY\n\t\t\tday\n\t\tORDER BY\n\t\t\tday DESC\n\t\tLIMIT 7\n\t") or phpAds_sqlDie(); } else { $res = phpAds_dbQuery("\n\t\t SELECT\n\t\t\tDATE_FORMAT(t_stamp, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(t_stamp, '{$date_format}') as date_formatted\n\t\t FROM\n\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t WHERE\n\t\t\tzoneid = '{$zoneid}'\n\t\t GROUP BY\n\t\t\tdate\n\t\t ORDER BY\n\t\t\tdate DESC\n\t\t LIMIT 7\n\t") or phpAds_sqlDie(); } while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext($row['date_formatted'], "stats-zone-daily.php?day=" . $row['date'] . "&affiliateid=" . $affiliateid . "&zoneid=" . $zoneid, $day == $row['date']); } if (phpAds_isUser(phpAds_Admin)) { 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.1.1"); echo "<img src='images/icon-affiliate.gif' align='absmiddle'> " . phpAds_getAffiliateName($affiliateid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-zone.gif' align='absmiddle'> <b>" . phpAds_getZoneName($zoneid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-date.gif' align='absmiddle'> <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>"; $sections[] = "2.4.2.1.1"; if (!$phpAds_config['compact_stats']) { $sections[] = "2.4.2.1.2"; }
} } if (!isset($period_range)) { if (isset($Session['prefs']['stats-zone-linkedbanners.php']['period_range'])) { $period_range = $Session['prefs']['stats-zone-linkedbanners.php']['period_range']; } else { $period_range = array('start_day' => 0, 'start_month' => 0, 'start_year' => 0, 'end_day' => 0, 'end_month' => 0, 'end_year' => 0); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\taffiliateid = '" . $affiliateid . "'\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildZoneName($row['zoneid'], $row['zonename']), "stats-zone-linkedbanners.php?affiliateid=" . $affiliateid . "&zoneid=" . $row['zoneid'], $zoneid == $row['zoneid']); } phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif'); phpAds_PageShortcut($strZoneProperties, 'zone-edit.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-zone.gif'); phpAds_PageShortcut($strIncludedBanners, 'zone-include.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-zone-linked.gif'); phpAds_PageHeader("2.4.2.2"); echo "<img src='images/icon-affiliate.gif' align='absmiddle'> " . phpAds_getAffiliateName($affiliateid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-zone.gif' align='absmiddle'> <b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.4.2.1", "2.4.2.2")); } else { phpAds_PageHeader("1.1.2"); echo "<img src='images/icon-zone.gif' align='absmiddle'> <b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>"; phpAds_ShowSections(array("1.1.1", "1.1.2")); } /*********************************************************/
echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>"; phpAds_ShowSections($sections); } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid = " . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . " AND agencyid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "stats-banner-sources.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } 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.2.2"); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> " . phpAds_getCampaignName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-banner-stored.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br><br>"; echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>"; phpAds_ShowSections(array("2.1.2.2.1", "2.1.2.2.2")); } /*********************************************************/ /* Main code */ /*********************************************************/
/*********************************************************/ /* HTML framework */ /*********************************************************/ if (isset($Session['prefs']['stats-campaign-banners.php']['listorder'])) { $navorder = $Session['prefs']['stats-campaign-banners.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['stats-campaign-banners.php']['orderdirection'])) { $navdirection = $Session['prefs']['stats-campaign-banners.php']['orderdirection']; } else { $navdirection = ''; } $res = phpAds_dbQuery("\n\tSELECT\n\t\t*\n\tFROM\n\t\t" . $phpAds_config['tbl_banners'] . "\n\tWHERE\n\t\tclientid = '{$campaignid}'\n\t" . phpAds_getBannerListOrder($navorder, $navdirection) . "\n") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildBannerName($row['bannerid'], $row['description'], $row['alt']), "stats-banner-affiliates.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $row['bannerid'], $bannerid == $row['bannerid']); } 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_PageShortcut($strBannerProperties, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-banner-stored.gif'); phpAds_PageShortcut($strModifyBannerAcl, 'banner-acl.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-acl.gif'); phpAds_PageHeader("2.1.2.2.2"); echo "<img src='images/icon-client.gif' align='absmiddle'> " . phpAds_getParentName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> " . phpAds_getClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-banner-stored.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br><br>"; echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>"; phpAds_ShowSections(array("2.1.2.2.1", "2.1.2.2.2")); /*********************************************************/ /* Main code */
echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("1.2.1", "1.2.2", "1.2.3", "1.2.4")); } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT m.campaignid,m.campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND m.clientid=" . $clientid . " AND c.agencyid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } 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.4"); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.1.2.1", "2.1.2.2", "2.1.2.3", "2.1.2.4", "2.1.2.5")); } /*********************************************************/ /* Main code */ /*********************************************************/ $lib_targetstats_params = array('clientid' => $clientid, 'campaignid' => $campaignid); $lib_targetstats_where = "campaignid = '" . $campaignid . "'"; include "lib-targetstats.inc.php";
} 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'> " . phpAds_getAffiliateName($affiliateid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-zone.gif' align='absmiddle'> " . phpAds_getZoneName($zoneid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-zone-linked.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.4.2.2.1")); } else { phpAds_PageHeader("1.1.2.1"); echo "<img src='images/icon-zone.gif' align='absmiddle'> " . phpAds_getZoneName($zoneid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> ";
function setAgencyPageContext($agencyid, $pageName) { $doAgency = OA_Dal::factoryDO('agency'); $doAgency->find(); while ($doAgency->fetch()) { phpAds_PageContext(phpAds_buildName($doAgency->agencyid, $doAgency->name), "{$pageName}?agencyid=" . $doAgency->agencyid, $agencyid == $doAgency->agencyid); } }
if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ $bannerids = array(); $idresult = phpAds_dbQuery("\n\tSELECT\n\t\tbannerid\n\tFROM\n\t\t" . $phpAds_config['tbl_banners'] . "\n\tWHERE\n\t\tcampaignid = '{$campaignid}'\n"); while ($row = phpAds_dbFetchArray($idresult)) { $bannerids[] = "bannerid = " . $row['bannerid']; } $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'> " . phpAds_getClientName($clientid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> " . phpAds_getCampaignName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-date.gif' align='absmiddle'> <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'> " . phpAds_getCampaignName($campaignid);
$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") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($res); if (isset($Session['prefs']['campaign-banners.php'][$campaignid]['listorder'])) { $navorder = $Session['prefs']['campaign-banners.php'][$campaignid]['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['campaign-banners.php'][$campaignid]['orderdirection'])) { $navdirection = $Session['prefs']['campaign-banners.php'][$campaignid]['orderdirection']; } else { $navdirection = ''; } // Get other banners $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\tcampaignid = '{$campaignid}'\n\t\t" . phpAds_getBannerListOrder($navorder, $navdirection) . "\n\t"); while ($others = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildBannerName($others['bannerid'], $others['description'], $others['alt']), "banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $others['bannerid'], $bannerid == $others['bannerid']); } 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_PageShortcut($strBannerHistory, 'stats-banner-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid, 'images/icon-statistics.gif'); $extra = "<form action='banner-modify.php'>"; $extra .= "<input type='hidden' name='bannerid' value='{$bannerid}'>"; $extra .= "<input type='hidden' name='clientid' value='{$clientid}'>"; $extra .= "<input type='hidden' name='campaignid' value='{$campaignid}'>"; $extra .= "<input type='hidden' name='returnurl' value='banner-edit.php'>"; $extra .= "<br><br>"; $extra .= "<b>{$strModifyBanner}</b><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-duplicate-banner.gif' align='absmiddle'> <a href='banner-modify.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $bannerid . "&duplicate=true&returnurl=banner-edit.php'>{$strDuplicate}</a><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
/*********************************************************/ if ($campaignid != "") { if (isset($Session['prefs']['client-campaigns.php'][$clientid]['listorder'])) { $navorder = $Session['prefs']['client-campaigns.php'][$clientid]['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['client-campaigns.php'][$clientid]['orderdirection'])) { $navdirection = $Session['prefs']['client-campaigns.php'][$clientid]['orderdirection']; } else { $navdirection = ''; } // Get other 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 = " . $clientid . "\n\t\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t"); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "campaign-edit.php?clientid=" . $clientid . "&campaignid=" . $row['clientid'], $campaignid == $row['clientid']); } phpAds_PageShortcut($strClientProperties, 'client-edit.php?clientid=' . $clientid, 'images/icon-client.gif'); phpAds_PageShortcut($strCampaignHistory, 'stats-campaign-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-statistics.gif'); $extra = "<form action='campaign-modify.php'>"; $extra .= "<input type='hidden' name='campaignid' value='{$campaignid}'>"; $extra .= "<input type='hidden' name='clientid' value='{$clientid}'>"; $extra .= "<input type='hidden' name='returnurl' value='campaign-edit.php'>"; $extra .= "<br><br>"; $extra .= "<b>{$strModifyCampaign}</b><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-move-campaign.gif' align='absmiddle'> {$strMoveTo}<br>"; $extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>"; $extra .= " "; $extra .= "<select name='moveto' style='width: 110px'>"; $res = phpAds_dbQuery("SELECT * FROM " . $phpAds_config['tbl_clients'] . " WHERE parent = 0 AND clientid != " . phpAds_getParentID($campaignid)) or phpAds_sqlDie();
/*********************************************************/ if ($trackerid != "") { if (isset($Session['prefs']['advertiser-trackers.php'][$clientid]['listorder'])) { $navorder = $Session['prefs']['advertiser-trackers.php'][$clientid]['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['advertiser-trackers.php'][$clientid]['orderdirection'])) { $navdirection = $Session['prefs']['advertiser-trackers.php'][$clientid]['orderdirection']; } else { $navdirection = ''; } // Get other trackers $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE clientid = " . $clientid . phpAds_getTrackerListOrder($navorder, $navdirection)) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['trackerid'], $row['trackername']), "tracker-invocation.php?clientid=" . $clientid . "&trackerid=" . $row['trackerid'], $trackerid == $row['trackerid']); } phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); //phpAds_PageShortcut($strTrackerHistory, 'stats-tracker-history.php?clientid='.$clientid.'&trackerid='.$trackerid, 'images/icon-statistics.gif'); $extra = "\t\t\t\t<form name='modif' action='tracker-modify.php'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='trackerid' value='{$trackerid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='clientid' value='{$clientid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='returnurl' value='tracker-invocation.php'>" . "\n"; $extra .= "\t\t\t\t<br><br>" . "\n"; $extra .= "\t\t\t\t<b>{$strModifyTracker}</b><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-duplicate-tracker.gif' align='absmiddle'> <a href='tracker-modify.php?clientid=" . $clientid . "&trackerid=" . $trackerid . "&duplicate=true&returnurl=tracker-invocation.php'>{$strDuplicate}</a><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-move-tracker.gif' align='absmiddle'> {$strMoveTo}<br>" . "\n"; $extra .= "\t\t\t\t<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>" . "\n"; $extra .= "\t\t\t\t " . "\n";