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(); }
// Security check OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER); OA_Permission::enforceAccountPermission(OA_ACCOUNT_ADVERTISER, OA_PERM_USER_LOG_ACCESS); OA_Permission::enforceAccountPermission(OA_ACCOUNT_TRAFFICKER, OA_PERM_USER_LOG_ACCESS); OA_Permission::enforceAccessToObject('audit', $auditId); /*-------------------------------------------------------*/ /* HTML framework */ /*-------------------------------------------------------*/ phpAds_PageHeader('userlog-index'); if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { // Show all "My Account" sections phpAds_ShowSections(array("5.1", "5.2", "5.3", "5.5", "5.6", "5.4")); phpAds_UserlogSelection("index"); } else { if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { // Show the "Preferences", "User Log" and "Channel Management" sections of the "My Account" sections phpAds_ShowSections(array("5.1", "5.2", "5.4", "5.7")); } else { if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) || OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) { phpAds_ShowSections(array("5.1", "5.2", "5.4")); } } } // initialize parameters $pageName = basename($_SERVER['SCRIPT_NAME']); $oTpl = new OA_Admin_Template('userlog-audit-detailed.html'); $oAudit = new OA_Dll_Audit(); $aAuditDetail = $oAudit->getAuditDetail($auditId); $oTpl->assign('aAuditDetail', $aAuditDetail); $oTpl->display(); phpAds_PageFooter();
} if ($showPublishers) { $aParams['publisher_id'] = $publisherId; $aParams['zone_id'] = $zoneId; } // 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(); } $oUserlog = new OA_Dll_Audit(); $aAuditData = $oUserlog->getAuditLog($aParams); $aParams['totalItems'] = count($aAuditData); if (!isset($pageID) || $pageID == 1) { $aParams['startRecord'] = 0; } else { $aParams['startRecord'] = $pageID * $setPerPage - $setPerPage; } if ($aParams['startRecord'] > $aParams['totalItems']) { $aParams['startRecord'] = 0; } $aParams['perPage'] = MAX_getStoredValue('setPerPage', 10); // Retrieve audit details $aAuditData = $oUserlog->getAuditLog($aParams); $pager =& Pager::factory($aParams); $per_page = $pager->_perPage;
function testGetContext() { $audit = new OA_Dll_Audit(); $context = $audit->getContextDescription($table = 'campaigns'); $doCampaigns = OA_Dal::factoryDO($table); $this->assertEqual($context, $doCampaigns->_getContext()); // test https://developer.openx.org/jira/browse/OX-3105 // Pear Error when User Log includes records for tables that no longer exist $table = 'foo_123'; $context = $audit->getContextDescription($table); $this->assertEqual($context, $table); }