function processBanners($commit = false) { $doBanners = OA_Dal::factoryDO('banners'); if (OA_INSTALLATION_STATUS === OA_INSTALLATION_STATUS_INSTALLED && OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $doBanners->addReferenceFilter('agency', $agencyId = OA_Permission::getEntityId()); } $doBanners->find(); $different = 0; $same = 0; $errors = array(); while ($doBanners->fetch()) { // Rebuild filename if ($doBanners->storagetype == 'sql' || $doBanners->storagetype == 'web') { $doBanners->imageurl = ''; } $GLOBALS['_MAX']['bannerrebuild']['errors'] = false; if ($commit) { $doBannersClone = clone $doBanners; $doBannersClone->update(); $newCache = $doBannersClone->htmlcache; } else { $newCache = phpAds_getBannerCache($doBanners->toArray()); } if (empty($GLOBALS['_MAX']['bannerrebuild']['errors'])) { if ($doBanners->htmlcache != $newCache && $doBanners->storagetype == 'html') { $different++; } else { $same++; } } else { $errors[] = $doBanners->toArray(); } } return array('errors' => $errors, 'different' => $different, 'same' => $same); }
public function beforePageHeader(OX_Admin_UI_Event_EventContext $oEventContext) { $pageId = $oEventContext->data['pageId']; $pageData = $oEventContext->data['pageData']; $oHeaderModel = $oEventContext->data['headerModel']; $agencyId = $pageData['agencyid']; $campaignId = $pageData['campaignid']; $advertiserId = $pageData['clientid']; $oEntityHelper = $this->oMarkedTextAdvertiserComponent->getEntityHelper(); if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { switch ($pageId) { case 'campaign-banners': $oDalZones = OA_Dal::factoryDAL('zones'); $linkedWebsites = $oDalZones->getWebsitesAndZonesListByCategory($agencyId, null, $campaignId, true); $arraylinkedWebsitesKeys = array_keys($linkedWebsites); $linkedWebsitesKey = $arraylinkedWebsitesKeys[0]; $arraylinkedZonesKeys = array_keys($linkedWebsites[$linkedWebsitesKey]['zones']); $zoneId = $arraylinkedZonesKeys[0]; $aZone = Admin_DA::getZone($zoneId); if ($aZone['type'] == 3) { if (OA_Permission::hasAccessToObject('clients', $clientid) && OA_Permission::hasAccessToObject('campaigns', $campaignid)) { OX_Admin_Redirect::redirect('plugins/' . $this->oMarkedTextAdvertiserComponent->group . "/oxMarkedTextAdvertiser-index.php?campaignid={$campaignId}&clientid={$advertiserId}"); } } break; } } }
private function parseEntityParams($aEntityParams) { $aMap = array('advertiser' => array('clientid'), 'campaign' => array('clientid', 'campaignid'), 'banner' => array('clientid', 'campaignid', 'bannerid'), 'affiliate' => array('affiliateid'), 'zone' => array('affiliateid', 'zoneid')); if (empty($aEntityParams['entity'])) { if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $aEntityParams['entity'] = 'advertiser'; } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $aEntityParams['entity'] = 'affiliate'; } else { $aEntityParams['entity'] = 'global'; } } if ($aEntityParams['entity'] != 'global') { $allowed = implode('|', array_keys($aMap)); if (!preg_match('/^(' . $allowed . ')(?:-(' . $allowed . '))?$/D', $aEntityParams['entity'], $aMatches)) { throw new exception("Unsupported entity breakdown"); } array_shift($aMatches); $this->entity = join('-', $aMatches); foreach ($aMatches as $type) { foreach ($aMap[$type] as $inputVar) { $this->aEntityParams[$inputVar] = !empty($aEntityParams[$inputVar]) ? (int) $aEntityParams[$inputVar] : 0; } } } else { $this->entity = 'global'; } }
/** * Merge aggregate stats with entity properties (name, children, etc) * * The overridden method also takes care to remove inactive entities * and to enforce the anonymous properties when logged in as advertiser * or publisher * * @param array Query parameters * @param string Key name * @return array Full entity stats with entity data */ function mergeData($aParams, $key) { $aEntitiesData = parent::mergeData($aParams, $key); if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) || OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { if (is_null($this->aAnonAdvertisers)) { $this->aAnonAdvertisers = array(); $this->aAnonPlacements = array(); $aPlacements = Admin_DA::fromCache('getPlacements', array('placement_anonymous' => 't')); foreach ($aPlacements as $placementId => $placement) { $this->aAnonAdvertisers[$placement['advertiser_id']] = true; $this->aAnonPlacements[$placementId] = true; } } } foreach (array_keys($aEntitiesData) as $entityId) { if (!isset($this->data[$key][$entityId])) { unset($aEntitiesData[$entityId]); } elseif ($key == 'advertiser_id' && isset($this->aAnonAdvertisers[$entityId])) { $aEntitiesData[$entityId]['hidden'] = true; } elseif ($key == 'placement_id' && isset($this->aAnonPlacements[$entityId])) { $aEntitiesData[$entityId]['hidden'] = true; } elseif ($key == 'ad_id' && isset($this->aAnonPlacements[$aEntitiesData[$entityId]['placement_id']])) { $aEntitiesData[$entityId]['hidden'] = true; } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { if (isset($aParams['placement_id'])) { $aEntitiesData[$entityId]['hidden'] = isset($this->aAnonPlacements[$aParams['placement_id']]); } else { $aEntitiesData[$entityId]['hidden'] = isset($this->aAnonAdvertisers[OA_Permission::getEntityId()]); } } } return $aEntitiesData; }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get parameters $advertiserId = $this->_getId('advertiser'); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER); $this->_checkAccess(array('advertiser' => $advertiserId)); // Add standard page parameters $this->aPageParams = array('clientid' => $advertiserId); // 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.1'; $this->aPageSections = array('2.1.1', '2.1.2', '2.1.3'); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $this->pageId = '1.1'; $this->aPageSections = array('1.1', '1.2', '1.3'); } // Add breadcrumbs $this->_addBreadcrumbs('advertiser', $advertiserId); // Add context $this->aPageContext = array('advertisers', $advertiserId); // Add shortcuts if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $this->_addShortcut($GLOBALS['strClientProperties'], 'advertiser-edit.php?clientid=' . $advertiserId, 'images/icon-advertiser.gif'); } // Prepare the data for display by output() method $aParams = array('advertiser_id' => $advertiserId); $this->prepare($aParams, 'stats.php'); }
/** * A method to launch and display the widget * */ function display() { $aConf = $GLOBALS['_MAX']['CONF']; $oTpl = new OA_Admin_Template('dashboard/disabled.html'); $oDashboard = new OA_Central_Dashboard(); $oTpl->assign('isAdmin', OA_Permission::isAccount(OA_ACCOUNT_ADMIN)); $oTpl->display(); }
function OA_footerNavigation() { echo "\n <script language='JavaScript'>\n <!--\n "; if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { echo "function MMM_cascadePermissionsChange()\n {\n var e = findObj('permissions_" . OA_PERM_ZONE_EDIT . "');\n var a = findObj('permissions_" . OA_PERM_ZONE_ADD . "');\n var d = findObj('permissions_" . OA_PERM_ZONE_DELETE . "');\n\n a.disabled = d.disabled = !e.checked;\n if (!e.checked) {\n a.checked = d.checked = false;\n }\n }\n MMM_cascadePermissionsChange();\n //-->"; } echo "</script>"; }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get the preferences $aPref = $GLOBALS['_MAX']['PREF']; // Get parameters $advertiserId = $this->_getId('advertiser'); $placementId = $this->_getId('placement'); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER); $this->_checkAccess(array('advertiser' => $advertiserId, 'placement' => $placementId)); // Add standard page parameters $this->aPageParams = array('clientid' => $advertiserId, 'campaignid' => $placementId); // 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'; $this->aPageSections = array('2.1.2.1', '2.1.2.2', '2.1.2.3', '2.1.2.4'); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $this->pageId = '1.2.2'; $this->aPageSections = array('1.2.1', '1.2.2', '1.2.3'); } // Add breadcrumbs $this->_addBreadcrumbs('campaign', $placementId); // Add context $this->aPageContext = array('campaigns', $placementId); // 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->hideInactive = MAX_getStoredValue('hideinactive', $aPref['ui_hide_inactive'] == true, null, true); $this->showHideInactive = true; $this->startLevel = 0; // Init nodes $this->aNodes = MAX_getStoredArray('nodes', array()); $expand = MAX_getValue('expand', ''); $collapse = MAX_getValue('collapse'); // Adjust which nodes are opened closed... MAX_adjustNodes($this->aNodes, $expand, $collapse); $aParams = $this->coreParams; $aParams['placement_id'] = $placementId; $this->aEntitiesData = $this->getBanners($aParams, $this->startLevel, $expand); // Summarise the values into a the totals array, & format $this->_summariseTotalsAndFormat($this->aEntitiesData); $this->showHideLevels = array(); $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveBannersHidden']}"; // Save prefs $this->aPagePrefs['startlevel'] = $this->startLevel; $this->aPagePrefs['nodes'] = implode(",", $this->aNodes); $this->aPagePrefs['hideinactive'] = $this->hideInactive; $this->aPagePrefs['startlevel'] = $this->startLevel; }
function phpAds_MaintenanceSelection($subSection, $mainSection = 'maintenance') { global $phpAds_TextDirection, $strBanners, $strCache, $strChooseSection, $strPriority, $strSourceEdit, $strStats, $strStorage, $strMaintenance, $strCheckForUpdates, $strViewPastUpdates, $strEncoding, $strDeliveryLimitations, $strAppendCodes, $strMenus, $strPlugins; ?> <script language="JavaScript"> <!-- function maintenance_goto_section() { s = document.maintenance_selection.section.selectedIndex; s = document.maintenance_selection.section.options[s].value; document.location = '<?php echo $mainSection; ?> -' + s + '.php'; } // --> </script> <?php $conf =& $GLOBALS['_MAX']['CONF']; $pref =& $GLOBALS['_MAX']['PREF']; echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><form name='maintenance_selection'><td height='35'>"; echo "<b>" . $strChooseSection . ": </b>"; echo "<select name='section' onChange='maintenance_goto_section();'>"; if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { if ($mainSection == 'updates') { echo "<option value='product'" . ($subSection == 'product' ? ' selected' : '') . ">" . $strCheckForUpdates . "</option>"; echo "<option value='history'" . ($subSection == 'history' ? ' selected' : '') . ">" . $strViewPastUpdates . "</option>"; } else { echo "<option value='maintenance'" . ($subSection == 'maintenance' ? ' selected' : '') . ">" . $strMaintenance . "</option>"; echo "<option value='banners'" . ($subSection == 'banners' ? ' selected' : '') . ">" . $strBanners . "</option>"; echo "<option value='priority'" . ($subSection == 'priority' ? ' selected' : '') . ">" . $strPriority . "</option>"; $login = '******' . $conf['store']['ftpUsername'] . ':' . $conf['store']['ftpPassword'] . '@' . $conf['store']['ftpHost'] . '/' . $conf['store']['ftpPath']; if ($conf['allowedBanners']['web'] == true && ($conf['store']['mode'] == 0 && $conf['store']['webDir'] != '' || $conf['store']['mode'] == 1 && $login != '') && $conf['webpath']['images'] != '') { echo "<option value='storage'" . ($subSection == 'storage' ? ' selected' : '') . ">" . $strStorage . "</option>"; } // if (!isset($conf['delivery']['cache']) || $conf['delivery']['cache'] != 'none') // echo "<option value='cache'".($subSection == 'zones' ? ' selected' : '').">".$strCache."</option>"; if ($conf['delivery']['acls']) { echo "<option value='acls'" . ($subSection == 'acls' ? ' selected' : '') . ">" . $strDeliveryLimitations . "</option>"; } echo "<option value='appendcodes'" . ($subSection == 'appendcodes' ? ' selected' : '') . ">" . $strAppendCodes . "</option>"; echo "<option value='encoding'" . ($subSection == 'encoding' ? ' selected' : '') . ">{$strEncoding}</option>"; echo "<option value='menus'" . ($subSection == 'menus' ? ' selected' : '') . ">" . $strMenus . "</option>"; echo "<option value='plugins'" . ($subSection == 'plugins' ? ' selected' : '') . ">" . $strPlugins . "</option>"; } } // Switched off // echo "<option value='finance'".($subSection == 'finance' ? ' selected' : '').">Finance</option>"; echo "</select> <a href='javascript:void(0)' onClick='maintenance_goto_section();'>"; echo "<img src='" . OX::assetPath() . "/images/" . $phpAds_TextDirection . "/go_blue.gif' border='0'></a>"; echo "</td></form></tr>"; echo "</table>"; phpAds_ShowBreak(); }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get the preferences $aPref = $GLOBALS['_MAX']['PREF']; // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER); // HTML Framework $this->pageId = '2.4'; $this->aPageSections = array('2.1', '2.4', '2.2'); $this->hideInactive = MAX_getStoredValue('hideinactive', $aPref['ui_hide_inactive'] == true, null, true); $this->showHideInactive = true; $this->startLevel = MAX_getStoredValue('startlevel', 0, null, true); // Init nodes $this->aNodes = MAX_getStoredArray('nodes', array()); $expand = MAX_getValue('expand', ''); $collapse = MAX_getValue('collapse'); // Adjust which nodes are opened closed... MAX_adjustNodes($this->aNodes, $expand, $collapse); $aParams = $this->coreParams; if (!OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { $aParams['agency_id'] = OA_Permission::getAgencyId(); } // Add module page parameters $this->aPageParams['period_preset'] = MAX_getStoredValue('period_preset', 'today'); $this->aPageParams['statsBreakdown'] = htmlspecialchars(MAX_getStoredValue('statsBreakdown', 'day')); $this->_loadParams(); switch ($this->startLevel) { case 1: $this->aEntitiesData = $this->getZones($aParams, $this->startLevel, $expand); break; default: $this->startLevel = 0; $this->aEntitiesData = $this->getPublishers($aParams, $this->startLevel, $expand); break; } // Summarise the values into a the totals array, & format $this->_summariseTotalsAndFormat($this->aEntitiesData); $this->showHideLevels = array(); switch ($this->startLevel) { case 1: $this->showHideLevels = array(0 => array('text' => $GLOBALS['strShowParentAffiliates'], 'icon' => 'images/icon-affiliate.gif')); $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveZonesHidden']}"; break; case 0: $this->showHideLevels = array(1 => array('text' => $GLOBALS['strHideParentAffiliates'], 'icon' => 'images/icon-affiliate-d.gif')); $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveAffiliatesHidden']}"; break; } // Save prefs $this->aPagePrefs['startlevel'] = $this->startLevel; $this->aPagePrefs['nodes'] = implode(",", $this->aNodes); $this->aPagePrefs['hideinactive'] = $this->hideInactive; $this->aPagePrefs['startlevel'] = $this->startLevel; }
function OA_HeaderNavigation() { global $agencyid; if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { phpAds_PageHeader("agency-access"); $doAgency = OA_Dal::staticGetDO('agency', $agencyid); MAX_displayInventoryBreadcrumbs(array(array("name" => $doAgency->name)), "agency"); } else { phpAds_PageHeader("agency-user"); } }
function getZones() { global $list_filters; if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { $aParams = array(); $aPublishers = Admin_DA::getPublishers($aParams); // set publisher id if list is to be filtered by publisher if (isset($list_filters['publisher'])) { $aParams = array('publisher_id' => $list_filters['publisher']); } else { // else use all publishers $aParams = array('publisher_id' => implode(',', array_keys($aPublishers))); } if (isset($this->_filter)) { $aParams['zone_inventory_forecast_type'] = $this->getForecastType(); } $aZones = Admin_DA::getZones($aParams); } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams = array('agency_id' => OA_Permission::getEntityId()); $aPublishers = Admin_DA::getPublishers($aParams); // set publisher id if list is to be filtered by publisher if (isset($list_filters['publisher'])) { $aParams = array('publisher_id' => $list_filters['publisher']); } else { // else use all of this agency's publishers $aParams = array('publisher_id' => implode(',', array_keys($aPublishers))); } if (isset($this->_filter)) { $aParams['zone_inventory_forecast_type'] = $this->getForecastType(); } $aZones = Admin_DA::getZones($aParams); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $aParams = array('publisher_id' => OA_Permission::getEntityId()); $aPublishers = Admin_DA::getPublishers($aParams); $aParams = array('publisher_id' => implode(',', array_keys($aPublishers))); if (isset($this->_filter)) { $aParams['zone_inventory_forecast_type'] = $this->getForecastType(); } $aZones = Admin_DA::getZones($aParams); } else { $aPublishers = array(); $aZones = array(); } $aZoneArray = array(); foreach ($aPublishers as $publisherId => $aPublisher) { foreach ($aZones as $zoneId => $aZone) { if ($aZone['publisher_id'] == $publisherId) { $aZoneArray[$zoneId] = phpads_buildName($publisherId, MAX_getPublisherName($aPublisher['name'])) . " - " . phpAds_buildName($zoneId, MAX_getZoneName($aZone['name'])); } } } return $aZoneArray; }
function getStats() { // Set time zone to local OA_setTimeZoneLocal(); $oEnd = new Date(); $oEnd->setHour(0); $oEnd->setMinute(0); $oEnd->setSecond(0); $oEnd->toUTC(); $oStart = new Date($oEnd); $oStart->subtractSpan(new Date_Span('7-0-0-0')); $oStart->toUTC(); $doDsah = OA_Dal::factoryDO('data_summary_ad_hourly'); $doDsah->selectAdd(); $doDsah->selectAdd("DATE_FORMAT(date_time, '%Y-%m-%d') AS day"); $doDsah->selectAdd('SUM(' . $doDsah->tableName() . '.impressions) AS total_impressions'); $doDsah->selectAdd('SUM(' . $doDsah->tableName() . '.clicks) AS total_clicks'); $doDsah->whereAdd("date_time >= '" . $doDsah->escape($oStart->format('%Y-%m-%d %H:%M:%S')) . "'"); $doDsah->whereAdd("date_time < '" . $doDsah->escape($oEnd->format('%Y-%m-%d %H:%M:%S')) . "'"); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $doBanners = OA_Dal::factoryDO('banners'); $doCampaigns = OA_Dal::factoryDO('campaigns'); $doClients = OA_Dal::factoryDO('clients'); $doClients->agencyid = OA_Permission::getEntityId(); $doCampaigns->joinAdd($doClients); $doBanners->joinAdd($doCampaigns); $doBanners->selectAdd(); $doBanners->selectAdd("bannerid"); $doBanners->find(); $ad_ids = array(); while ($doBanners->fetch()) { $ad_ids[] = $doBanners->bannerid; } if (empty($ad_ids)) { return array(); } $doDsah->whereAdd("ad_id IN (" . implode(",", $ad_ids) . ")"); } $doDsah->groupBy('day'); $doDsah->orderBy('day'); $doDsah->find(); $aStats = array(); while ($doDsah->fetch()) { $row = $doDsah->toArray(); $aStats[0][date('D', strtotime($row['day']))] = $row['total_impressions']; $aStats[1][date('D', strtotime($row['day']))] = $row['total_clicks']; } return $aStats; }
function _getTrackerArray() { $conf = $GLOBALS['_MAX']['CONF']; $where = "c.clientid = t.clientid"; if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $where .= " AND c.agencyid = " . OA_Permission::getEntityId(); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $where .= " AND t.clientid = " . OA_Permission::getEntityId(); } $query = "\n SELECT\n c.clientname AS client_name,\n c.clientid AS client_id,\n t.trackername AS tracker_name,\n t.trackerid AS tracker_id\n FROM\n {$conf['table']['trackers']} AS t,\n {$conf['table']['clients']} AS c\n WHERE\n {$where}\n ORDER BY\n c.clientname,t.trackername\n "; $res = phpAds_dbQuery($query); while ($row = phpAds_dbFetchArray($res)) { $trackerArray[$row['tracker_id']] = "<span dir='" . $GLOBALS['phpAds_TextDirection'] . "'>[id" . $row['client_id'] . "] " . $row['client_name'] . " - [id" . $row['tracker_id'] . "] " . $row['tracker_name'] . "</span> "; } return $trackerArray; }
function check($oSection) { $aAccounts = $this->_getAllowedAccountTypes(); //no required accounts to show it if (empty($aAccounts)) { return true; } $isAllowedAccount = false; for ($i = 0; $i < count($aAccounts); $i++) { $isAllowedAccount = OA_Permission::isAccount($aAccounts[$i]); if ($isAllowedAccount) { break; } } return $isAllowedAccount; }
function display() { $conf = $GLOBALS['_MAX']['CONF']; if (!$conf['audit']['enabled']) { $this->oTpl->assign('screen', 'disabled'); $this->oTpl->assign('siteTitle', $GLOBALS['strAuditTrailSetup']); $this->oTpl->assign('siteUrl', MAX::constructUrl(MAX_URL_ADMIN, 'account-settings-debug.php')); } else { // Account security if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams['account_id'] = OA_Permission::getAccountId(); } if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $aParams['advertiser_account_id'] = OA_Permission::getAccountId(); } if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $aParams['website_account_id'] = OA_Permission::getAccountId(); } $oAudit = new OA_Dll_Audit(); $aAuditData = $oAudit->getAuditLogForAuditWidget($aParams); if (count($aAuditData) > 0) { foreach ($aAuditData as $key => $aValue) { $aValue['action'] = $this->oTrans->translate($oAudit->getActionName($aValue['actionid'])); $result = $oAudit->getParentContextData($aValue); $str = "{$aValue['username']} {$GLOBALS['strHas']} {$aValue['action']} {$aValue['context']}"; if (!empty($aValue['contextid'])) { $str .= " ({$aValue['contextid']})"; } if (!empty($aValue['parentcontext'])) { $str .= " {$GLOBALS['strFor']} {$aValue['parentcontext']} ({$aValue['parentcontextid']})"; } if (!empty($aValue['hasChildren'])) { $str .= " {$GLOBALS['strAdditionItems']}"; } $aAuditData[$key]['desc'] = strlen($str) > 30 ? substr($str, 0, 30) . '...' : $str; } } else { $this->oTpl->assign('noData', $GLOBALS['strAuditNoData']); } $this->oTpl->assign('screen', 'enabled'); $this->oTpl->assign('aAuditData', $aAuditData); $this->oTpl->assign('siteUrl', MAX::constructUrl(MAX_URL_ADMIN, 'userlog-index.php')); $this->oTpl->assign('siteTitle', $GLOBALS['strAuditTrailGoTo']); } $this->oTpl->display(); }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get parameters $publisherId = $this->_getId('publisher'); $placementId = $this->_getId('placement', 0); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_TRAFFICKER); $this->_checkAccess(array('publisher' => $publisherId)); // Fetch campaigns $aPlacements = $this->getPublisherCampaigns($publisherId); // Cross-entity security check if (!isset($aPlacements[$placementId])) { $this->noStatsAvailable = true; } // Add standard page parameters $this->aPageParams = array('affiliateid' => $publisherId, 'campaignid' => $placementId, 'zoneid' => $zoneId); // 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.3.1'; $this->aPageSections = array($this->pageId); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->pageId = '1.3.1'; $this->aPageSections = array($this->pageId); } // Add breadcrumbs $this->_addBreadcrumbs('publisher', $publisherId); $this->addCrossBreadcrumbs('campaign', $placementId); // Add context $params = $this->aPageParams; foreach ($aPlacements as $k => $v) { $params['campaignid'] = $k; phpAds_PageContext(MAX_buildName($k, MAX_getPlacementName($v)), $this->_addPageParamsToURI($this->pageName, $params, true), $placementId == $k); } // Add shortcuts if (!OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->_addShortcut($GLOBALS['strAffiliateProperties'], 'affiliate-edit.php?affiliateid=' . $publisherId, 'images/icon-affiliate.gif'); } // Prepare the data for display by output() method $aParams = array('publisher_id' => $publisherId, 'placement_id' => $placementId); $this->prepare($aParams, 'stats.php'); }
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); } }
/** * @todo Handle cases where user is not Admin, Agency or Advertiser */ function _getPublisherArray($orderBy = null) { $conf = $GLOBALS['_MAX']['CONF']; if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { $query = "SELECT affiliateid,name" . " FROM " . $conf['table']['prefix'] . $conf['table']['affiliates']; } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $query = "SELECT affiliateid,name" . " FROM " . $conf['table']['prefix'] . $conf['table']['affiliates'] . " WHERE agencyid=" . OA_Permission::getEntityId(); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $query = "SELECT affiliateid,name" . " FROM " . $conf['table']['prefix'] . $conf['table']['affiliates'] . " WHERE affiliateid=" . OA_Permission::getEntityId(); } $orderBy ? $query .= " ORDER BY {$orderBy} ASC" : 0; $res = phpAds_dbQuery($query); while ($row = phpAds_dbFetchArray($res)) { $affiliateArray[$row['affiliateid']] = phpAds_buildAffiliateName($row['affiliateid'], $row['name']); } return $affiliateArray; }
function _getAdvertiserArray($orderBy = null) { $conf = $GLOBALS['_MAX']['CONF']; if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { $query = "SELECT clientid,clientname" . " FROM " . $conf['table']['prefix'] . $conf['table']['clients']; } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $query = "SELECT clientid,clientname" . " FROM " . $conf['table']['prefix'] . $conf['table']['clients'] . " WHERE agencyid=" . OA_Permission::getEntityId(); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $query = "SELECT clientid,clientname" . " FROM " . $conf['table']['prefix'] . $conf['table']['clients'] . " WHERE clientid=" . OA_Permission::getEntityId(); } $orderBy ? $query .= " ORDER BY {$orderBy} ASC" : 0; $oDbh = OA_DB::singleton(); $oRes = $oDbh->query($query); while ($row = $oRes->fetchRow()) { $clientArray[$row['clientid']] = phpAds_buildName($row['clientid'], $row['clientname']); } return $clientArray; }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get parameters $advertiserId = $this->_getId('advertiser'); $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)); // Add standard page parameters $this->aPageParams = array('clientid' => $advertiserId, '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.1'; $this->aPageSections = array('2.1.2.2.1', '2.1.2.2.2', '2.1.2.2.3'); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $this->pageId = '1.2.2.1'; $this->aPageSections[] = '1.2.2.1'; if (OA_Permission::hasPermission(OA_PERM_BANNER_EDIT)) { $this->aPageSections[] = '1.2.2.2'; } $this->aPageSections[] = '1.2.2.4'; } // Add breadcrumbs $this->_addBreadcrumbs('banner', $adId); // Add context $this->aPageContext = array('banners', $adId); // 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); $this->prepare($aParams, 'stats.php'); }
/** * Check administrator login during the upgrade steps * * @return boolean True if login succeded */ function checkLogin() { if (empty($_COOKIE['oat']) || $_COOKIE['oat'] != OA_UPGRADE_UPGRADE) { return true; } // Clean up session $GLOBALS['session'] = array(); // Detection needs to happen every time to make sure that database parameters are $oUpgrader = new OA_Upgrade(); $openadsDetected = $oUpgrader->detectOpenads(true) || $oUpgrader->existing_installation_status == OA_STATUS_CURRENT_VERSION; // Sequentially check, to avoid useless work if (!$openadsDetected) { if (!($panDetected = $oUpgrader->detectPAN(true))) { if (!($maxDetected = $oUpgrader->detectMAX(true))) { if (!($max01Detected = $oUpgrader->detectMAX01(true))) { // No upgrade-able version detected, return return false; } } } } phpAds_SessionStart(); OA_Upgrade_Login::readSession($panDetected); $oPlugin = new Plugins_Authentication(); if ($oPlugin->suppliedCredentials()) { // The new Users, Account, Permissions & Preference feature was introduced in OpenX 2.5.46-dev $newLogin = $openadsDetected && version_compare($oUpgrader->versionInitialApplication, '2.5.46-dev', '>=') == -1; if ($newLogin) { OA_Upgrade_Login::_checkLoginNew(); } else { if ($openadsDetected || $maxDetected) { OA_Upgrade_Login::_checkLoginOld('preference', true); } elseif ($max01Detected) { OA_Upgrade_Login::_checkLoginOld('config', true); } elseif ($panDetected) { OA_Upgrade_Login::_checkLoginOld('config', false); } else { return false; } } } return OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isUserLinkedToAdmin(); }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER); // Load the period preset and stats breakdown parameters $this->_loadPeriodPresetParam(); $this->_loadStatsBreakdownParam(); // Load $_GET parameters $this->_loadParams(); // HTML Framework $this->pageId = '2.2'; $this->aPageSections = array('2.1', '2.4', '2.2'); // Prepare the data for display by output() method $aParams = array(); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams['agency_id'] = OA_Permission::getAgencyId(); } $this->prepare($aParams, 'stats.php'); }
function display() { $aParams = array(); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $aParams['agency_id'] = OA_Permission::getEntityId(); } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $aParams['advertiser_id'] = OA_Permission::getEntityId(); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $aParams['publisher_id'] = OA_Permission::getEntityId(); } $aPlacements = Admin_DA::getPlacements($aParams, true); $aPlacements = $this->multiSort($aPlacements, "name", true); echo "\n <select name='{$this->_name}' tabindex='" . $this->_tabIndex++ . "'>"; foreach ($aPlacements as $aPlacement) { $selected = $aPlacement['placement_id'] == $this->getValue() ? " selected='selected'" : ''; $name = MAX_getPlacementName($aPlacement); echo "\n <option value='{$aPlacement['placement_id']}'{$selected}>" . htmlspecialchars($name) . "</option>"; } echo "\n </select>"; }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get parameters $publisherId = $this->_getId('publisher'); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_TRAFFICKER); $this->_checkAccess(array('publisher' => $publisherId)); // Add standard page parameters $this->aPageParams = array('affiliateid' => $publisherId); // 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.1'; $this->aPageSections = array('2.4.1', '2.4.2', '2.4.3'); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->pageId = '1.1'; $this->aPageSections = array('1.1', '1.2', '1.3'); } // Add breadcrumbs $this->_addBreadcrumbs('publisher', $publisherId); // Add context $this->aPageContext = array('publishers', $publisherId); // Add shortcuts if (!OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->_addShortcut($GLOBALS['strAffiliateProperties'], 'affiliate-edit.php?affiliateid=' . $publisherId, 'images/icon-affiliate.gif'); } // Prepare the data for display by output() method $aParams = array('publisher_id' => $publisherId); // Limit by advertiser $advertiserId = (int) MAX_getValue('clientid', ''); if (!empty($advertiserId)) { $aParams['advertiser_id'] = $advertiserId; } $this->prepare($aParams, 'stats.php'); }
/** * A method to determine if a report can be executed by a user or not. * * @return boolean True if the report is allowed to be executed by the * current user, false otherwise. */ function isAllowedToExecute() { // Backwards-compatible way of pulling authorization $aInfo = $this->info(); $authorizedUserTypes = $aInfo['plugin-authorize']; return OA_Permission::isAccount($authorizedUserTypes); }
/** * The final "child" implementation of the parental abstract method. * * @see OA_Admin_Statistics_Common::start() */ function start() { // Get the preferences $aPref = $GLOBALS['_MAX']['PREF']; // Get parameters $publisherId = $this->_getId('publisher'); $zoneId = $this->_getId('zone'); // Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_TRAFFICKER); $this->_checkAccess(array('publisher' => $publisherId, 'zone' => $zoneId)); // Add standard page parameters $this->aPageParams = array('affiliateid' => $publisherId, 'zoneid' => $zoneId); // 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'; $this->aPageSections = array('2.4.2.1', '2.4.2.2'); } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) { $this->pageId = '1.2.2'; $this->aPageSections = array('1.2.1', '1.2.2'); } // Add breadcrumbs $this->_addBreadcrumbs('zone', $zoneId); // Add context $this->aPageContext = array('zones', $zoneId); // 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'); // Fix entity links $this->entityLinks['c'] = 'stats.php?entity=zone&breakdown=campaign-history'; $this->entityLinks['b'] = 'stats.php?entity=zone&breakdown=banner-history'; $this->hideInactive = MAX_getStoredValue('hideinactive', $aPref['ui_hide_inactive'] == true, null, true); $this->showHideInactive = true; $this->startLevel = MAX_getStoredValue('startlevel', 0, null, true); // Init nodes $this->aNodes = MAX_getStoredArray('nodes', array()); $expand = MAX_getValue('expand', ''); $collapse = MAX_getValue('collapse'); // Adjust which nodes are opened closed... MAX_adjustNodes($this->aNodes, $expand, $collapse); $aParams = $this->coreParams; $aParams['zone_id'] = $zoneId; switch ($this->startLevel) { case 1: $this->aEntitiesData = $this->getBanners($aParams, $this->startLevel, $expand, true); break; default: $this->startLevel = 0; $this->aEntitiesData = $this->getCampaigns($aParams, $this->startLevel, $expand); break; } // Summarise the values into a the totals array, & format $this->_summariseTotalsAndFormat($this->aEntitiesData); $this->showHideLevels = array(); switch ($this->startLevel) { case 1: $this->showHideLevels = array(0 => array('text' => $GLOBALS['strShowParentCampaigns'], 'icon' => 'images/icon-campaign.gif')); $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveBannersHidden']}"; break; case 0: $this->showHideLevels = array(1 => array('text' => $GLOBALS['strHideParentCampaigns'], 'icon' => 'images/icon-campaign-d.gif')); $this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveCampaignsHidden']}"; break; } // Add standard page parameters $this->aPageParams = array('affiliateid' => $publisherId, 'zoneid' => $zoneId); $this->aPageParams['period_preset'] = MAX_getStoredValue('period_preset', 'today'); $this->aPageParams['statsBreakdown'] = htmlspecialchars(MAX_getStoredValue('statsBreakdown', 'day')); $this->_loadParams(); // Save prefs $this->aPagePrefs['startlevel'] = $this->startLevel; $this->aPagePrefs['nodes'] = implode(",", $this->aNodes); $this->aPagePrefs['hideinactive'] = $this->hideInactive; $this->aPagePrefs['startlevel'] = $this->startLevel; }
$translated_message = $translation->translate($GLOBALS['strTrackerVarsHaveBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $clientid . "&trackerid=" . $trackerid), htmlspecialchars($doTrackers->trackername))); OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0); // unset variables! unset($session['prefs']['tracker-variables.php']); phpAds_SessionDataStore(); // Rebuild cache // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php'; // phpAds_CacheDelete('what=tracker:' . $trackerid); // redirect to the next page header("Location: tracker-variables.php?clientid=" . $clientid . "&trackerid=" . $trackerid); exit; } } $doClients = OA_Dal::factoryDO('clients'); $doClients->whereAdd('clientid <>' . $trackerid); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $doClients->agencyid = OA_Permission::getAgencyId(); } $doClients->find(); $aOtherAdvertisers = array(); while ($doClients->fetch() && ($row = $doClients->toArray())) { $aOtherAdvertisers[] = $row; } MAX_displayNavigationTracker($clientid, $trackerid, $aOtherAdvertisers); //Start $tabindex = 0; if (isset($trackerid) && $trackerid != '') { echo "<form action='" . $_SERVER['SCRIPT_NAME'] . "?clientid={$clientid}&trackerid={$trackerid}' method='post' onsubmit='return m3_hideShowSubmit()'>\n"; echo "<input type='hidden' name='submit' value='true'>"; echo "<input type='image' name='dummy' src='" . OX::assetPath() . "/images/spacer.gif' border='0' width='1' height='1'>\n"; echo "<br /><br />\n";
function getAdvertiserMap() { $aAdvertisers = array(); $dalClients = OA_Dal::factoryDAL('clients'); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $agency_id = OA_Permission::getEntityId(); $aAdvertisers = $dalClients->getAllAdvertisersForAgency($agency_id); } else { if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { $advertiserId = OA_Permission::getEntityId(); $aAdvertiser = $dalClients->getAdvertiserDetails($advertiserId); $aAdvertisers[$advertiserId] = $aAdvertiser; } } $aAdvertiserMap = array(); foreach ($aAdvertisers as $clientid => $aClient) { $aAdvertiserMap[$clientid] = array('name' => $aClient['clientname'], 'url' => "advertiser-campaigns.php?clientid=" . $clientid); } return $aAdvertiserMap; }
function phpAds_getBannerName($bannerid, $limit = 30, $id = true, $checkanonymous = false) { $conf = $GLOBALS['_MAX']['CONF']; global $bannerCache; if (isset($bannerCache[$bannerid]) && is_array($bannerCache[$bannerid])) { $row = $bannerCache[$bannerid]; } else { $doBanners = OA_Dal::staticGetDO('banners', $bannerid); $row = $doBanners->toArray(); if ($checkanonymous) { $doCampaigns = OA_Dal::staticGetDO('campaigns', $row['campaignid']); $row['anonymous'] = $doCampaigns->anonymous; if ((OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) || OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) && MAX_isAnonymous($row['anonymous'])) { $row['description'] = $GLOBALS['strHiddenAd'] . ' ' . $bannerid; } } $bannerCache[$bannerid] = $row; } if ($id) { return phpAds_buildBannerName($bannerid, $row['description'], $row['alt'], $limit); } else { return phpAds_buildBannerName('', $row['description'], $row['alt'], $limit); } }