本文整理汇总了PHP中OA_Permission类的典型用法代码示例。如果您正苦于以下问题:PHP OA_Permission类的具体用法?PHP OA_Permission怎么用?PHP OA_Permission使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Permission类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OA_Central_M2M
/**
* Class constructor
*
* @param string $accountId If null, the current account ID is used
* @param string $accountType If null, the current account type is used
* @return OA_Central_M2M
*/
function OA_Central_M2M($accountId = null)
{
parent::OA_Central_Common();
$currentId = OA_Permission::getAccountId();
if (is_null($accountId)) {
$this->accountId = $currentId;
} else {
$this->accountId = $accountId;
}
if ($this->accountId == $currentId) {
$this->accountType = OA_Permission::getAccountType();
} else {
$doAccounts = OA_Dal::factoryDO('accounts');
$doAccounts->account_id = $this->accountId;
$doAccounts->find();
if ($doAccounts->fetch()) {
$this->accountType = $doAccounts->account_type;
} else {
Max::raiseError('Unexisting account ID', null, PEAR_ERROR_DIE);
}
}
if ($this->accountType == OA_ACCOUNT_ADMIN) {
$this->accountId = 0;
}
}
示例2: processBanners
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);
}
示例3: getWebsitesAndZonesByAgencyId
function getWebsitesAndZonesByAgencyId($agencyId = null)
{
if (is_null($agencyId)) {
$agencyId = OA_Permission::getAgencyId();
}
$prefix = $this->getTablePrefix();
$oDbh = OA_DB::singleton();
$tableW = $oDbh->quoteIdentifier($prefix . $this->table, true);
$tableZ = $oDbh->quoteIdentifier($prefix . 'zones', true);
// Select out websites only first (to ensure websites with no zones are included in the list)
$aWebsitesAndZones = array();
$query = "\n SELECT\n w.affiliateid AS website_id,\n w.website AS website_url,\n w.name AS website_name\n FROM\n {$tableW} AS w\n WHERE\n w.agencyid = " . DBC::makeLiteral($agencyId) . "\n ORDER BY w.name";
$rsAffiliates = DBC::NewRecordSet($query);
$rsAffiliates->find();
while ($rsAffiliates->fetch()) {
$aWebsiteZone = $rsAffiliates->toArray();
$aWebsitesAndZones[$aWebsiteZone['website_id']]['name'] = $aWebsiteZone['website_name'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['url'] = $aWebsiteZone['website_url'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['zones'] = array();
}
$query = "\n SELECT\n w.affiliateid AS website_id,\n w.website AS website_url,\n w.name AS website_name,\n z.zoneid AS zone_id,\n z.zonename AS zone_name,\n z.width AS zone_width,\n z.height AS zone_height\n FROM\n {$tableW} AS w,\n {$tableZ} AS z\n WHERE\n z.affiliateid = w.affiliateid\n AND w.agencyid = " . DBC::makeLiteral($agencyId) . "\n ORDER BY w.name";
$rsAffiliatesAndZones = DBC::NewRecordSet($query);
$rsAffiliatesAndZones->find();
while ($rsAffiliatesAndZones->fetch()) {
$aWebsiteZone = $rsAffiliatesAndZones->toArray();
$aWebsitesAndZones[$aWebsiteZone['website_id']]['name'] = $aWebsiteZone['website_name'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['url'] = $aWebsiteZone['website_url'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['zones'][$aWebsiteZone['zone_id']] = array('name' => $aWebsiteZone['zone_name'], 'width' => $aWebsiteZone['zone_width'], 'height' => $aWebsiteZone['zone_height']);
}
return $aWebsitesAndZones;
}
示例4: export
/**
* The method to generate a plugin-style report XLS from an already
* prepared statistics page OA_Admin_Statistics_Common object.
*/
function export()
{
// Prepare the report name
// Get system navigation
$oMenu = OA_Admin_Menu::singleton();
// Get section by pageId
$oCurrentSection = $oMenu->get($this->oStatsController->pageId);
if ($oCurrentSection == null) {
phpAds_Die($GLOBALS['strErrorOccurred'], 'Menu system error: <strong>' . OA_Permission::getAccountType(true) . '::' . htmlspecialchars($ID) . '</strong> not found for the current user');
}
// Get name
$reportName = $oCurrentSection->getName();
$this->_name = $reportName;
// Prepare the output writer for generation
$reportFileName = 'Exported Statistics - ' . $reportName;
if (!empty($this->oStatsController->aDates['day_begin'])) {
$oStartDate = new Date($this->oStatsController->aDates['day_begin']);
$reportFileName .= ' from ' . $oStartDate->format($GLOBALS['date_format']);
}
if (!empty($this->oStatsController->aDates['day_end'])) {
$oEndDate = new Date($this->oStatsController->aDates['day_end']);
$reportFileName .= ' to ' . $oEndDate->format($GLOBALS['date_format']);
}
$reportFileName .= '.xls';
$this->_oReportWriter->openWithFilename($reportFileName);
// Get the header and data arrays from the same statistics controllers
// that prepare stats for the user interface stats pages
list($aHeaders, $aData) = $this->getHeadersAndDataFromStatsController(null, $this->oStatsController);
// Add the worksheet
$name = ucfirst($this->oStatsController->entity) . ' ' . ucfirst($this->oStatsController->breakdown);
$this->createSubReport($reportName, $aHeaders, $aData);
// Close the report writer and send the report to the user
$this->_oReportWriter->closeAndSend();
}
示例5: mergeData
/**
* 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;
}
示例6: checkAccess
/**
* A method to check for permissions to display the widget
*
*/
function checkAccess()
{
if (empty($this->accessList)) {
$this->accessList = array(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER);
}
OA_Permission::enforceAccount($this->accessList);
}
示例7: beforePageHeader
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;
}
}
}
示例8: start
/**
* 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');
}
示例9: parseEntityParams
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';
}
}
示例10: OA_footerNavigation
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>";
}
示例11: display
/**
* 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();
}
示例12: start
/**
* 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;
}
示例13: phpAds_MaintenanceSelection
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 = 'ftp://' . $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();
}
示例14: clearEntitiesInSession
private function clearEntitiesInSession()
{
global $session;
$clientid = $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'];
unset($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid']);
if ($clientid) {
unset($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid]);
}
phpAds_SessionDataStore();
}
示例15: getAgencyDetails
function getAgencyDetails($agencyId = null)
{
if (is_null($agencyId)) {
$agencyId = OA_Permission::getAgencyId();
}
$doAgency =& OA_Dal::factoryDO('agency');
$doAgency->get($agencyId);
$aResult = $doAgency->toArray();
return $aResult;
}