コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
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);
}
 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();
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 /**
  * @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;
 }
コード例 #8
0
 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;
 }
コード例 #9
0
 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>";
 }
コード例 #10
0
ファイル: Menu.php プロジェクト: villos/tree_admin
 /**
  * Gets list of other advertisers and set a menu page context variable with them
  * Can be easily reused across inventory->advertisers pages
  *
  * TODO: Consider reading page name from automatically instead of passing it as a parameter
  *
  * @static
  * @param integer $clientid  Advertiser ID
  * @param string $pageName
  * @param string $sortPageName
  */
 function setAdvertiserPageContext($clientid, $pageName, $sortPageName = 'advertiser-index.php')
 {
     $doClients = OA_Dal::factoryDO('clients');
     $doClients->agencyid = OA_Permission::getEntityId();
     $doClients->addSessionListOrderBy($sortPageName);
     $doClients->find();
     while ($doClients->fetch()) {
         phpAds_PageContext(phpAds_buildName($doClients->clientid, $doClients->clientname), "{$pageName}?clientid=" . $doClients->clientid, $clientid == $doClients->clientid);
     }
 }
コード例 #11
0
ファイル: common.php プロジェクト: villos/tree_admin
function MAX_checkZone($publisherId, $zoneId)
{
    $allowed = false;
    if (MAX_checkGenericId($publisherId) && MAX_checkGenericId($zoneId)) {
        if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
            $allowed = count(Admin_DA::getZones(array('publisher_id' => $publisherId, 'zone_id' => $zoneId)));
        } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
            $allowed = count(Admin_DA::getZones(array('agency_id' => OA_Permission::getAgencyId(), 'publisher_id' => $publisherId, 'zone_id' => $zoneId)));
        } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
            $allowed = $publisherId == OA_Permission::getEntityId() && count(Admin_DA::getZones(array('publisher_id' => $publisherId, 'zone_id' => $zoneId)));
        }
    }
    return $allowed;
}
コード例 #12
0
ファイル: config.php プロジェクト: JackyKit/revive-adserver
    $affiliateid = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : '';
}
if (!isset($agencyid)) {
    $agencyid = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? '' : OA_Permission::getAgencyId();
}
if (!isset($bannerid)) {
    $bannerid = '';
}
if (!isset($campaignid)) {
    $campaignid = '';
}
if (!isset($channelid)) {
    $channelid = '';
}
if (!isset($clientid)) {
    $clientid = OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) ? OA_Permission::getEntityId() : '';
}
if (!isset($day)) {
    $day = '';
}
if (!isset($trackerid)) {
    $trackerid = '';
}
if (!isset($userlogid)) {
    $userlogid = '';
}
if (!isset($zoneid)) {
    $zoneid = '';
}
/**
 * Starts or continue existing session
コード例 #13
0
require_once MAX_PATH . '/lib/max/other/html.php';
// Register input variables
phpAds_registerGlobal('action', 'variablemethod');
// Since there may be an unknown number of variables posted (which are accessed by $_POST directly in the code below),
// clean the whole $_POST array
MAX_commonRemoveSpecialChars($_POST);
/*-------------------------------------------------------*/
/* Affiliate interface security                          */
/*-------------------------------------------------------*/
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('trackers', $trackerid);
/*-------------------------------------------------------*/
/* Store preferences									 */
/*-------------------------------------------------------*/
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
phpAds_SessionDataStore();
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
if (!isset($variables)) {
    if (isset($session['prefs']['tracker-variables.php']['variables']) && $session['prefs']['tracker-variables.php']['trackerid'] == $trackerid) {
        $variables = $session['prefs']['tracker-variables.php']['variables'];
    }
}
if (!empty($trackerid)) {
    // Get publisher list
    $dalAffiliates = OA_Dal::factoryDAL('affiliates');
    $rsAffiliates = $dalAffiliates->getPublishersByTracker($trackerid);
    $rsAffiliates->find();
    $publishers = array();
コード例 #14
0
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;
}
コード例 #15
0
function displayPage($bannerid, $campaignid, $clientid, $bannerTypes, $aBanner, $type, $form, $ext_bannertype, $formDisabled = false)
{
    // Initialise some parameters
    $pageName = basename($_SERVER['SCRIPT_NAME']);
    $aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);
    $entityId = OA_Permission::getEntityId();
    if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
        $entityType = 'advertiser_id';
    } else {
        $entityType = 'agency_id';
    }
    // Display navigation
    $aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId));
    $aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);
    // Display banner preview
    MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);
    //actual page content - type chooser and form
    /*-------------------------------------------------------*/
    /* Main code                                             */
    /*-------------------------------------------------------*/
    $oTpl = new OA_Admin_Template('banner-edit.html');
    $oTpl->assign('clientId', $clientid);
    $oTpl->assign('campaignId', $campaignid);
    $oTpl->assign('bannerId', $bannerid);
    $oTpl->assign('bannerTypes', $bannerTypes);
    $oTpl->assign('bannerType', $ext_bannertype ? $ext_bannertype : $type);
    $oTpl->assign('bannerHeight', $aBanner["height"]);
    $oTpl->assign('bannerWidth', $aBanner["width"]);
    $oTpl->assign('disabled', $formDisabled);
    $oTpl->assign('form', $form->serialize());
    $oTpl->display();
    /*********************************************************/
    /* HTML framework                                        */
    /*********************************************************/
    phpAds_PageFooter();
}
コード例 #16
0
ファイル: Common.php プロジェクト: ballistiq/revive-adserver
 /**
  * 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;
         }
     }
 }
コード例 #17
0
ファイル: zone-edit.php プロジェクト: villos/tree_admin
/**
 * Processes submit values of zone form
 *
 * @param OA_Admin_UI_Component_Form $form form to process
 * @return An array of Pear::Error objects if any
 */
function processForm($form)
{
    $aFields = $form->exportValues();
    switch ($aFields['delivery']) {
        case phpAds_ZoneText:
            $aFields['width'] = $aFields['height'] = 0;
            break;
        case OX_ZoneVideoOverlay:
            $aFields['width'] = $aFields['height'] = -2;
            break;
        case OX_ZoneVideoInstream:
            $aFields['width'] = $aFields['height'] = -3;
            break;
        default:
            if ($aFields['sizetype'] == 'custom') {
                if (isset($aFields['width']) && $aFields['width'] == '*') {
                    $aFields['width'] = -1;
                }
                if (isset($aFields['height']) && $aFields['height'] == '*') {
                    $aFields['height'] = -1;
                }
            } else {
                list($aFields['width'], $aFields['height']) = explode('x', $aFields['size']);
            }
            break;
    }
    if (!is_numeric($aFields['oac_category_id']) || $aFields['oac_category_id'] <= 0) {
        $aFields['oac_category_id'] = 'NULL';
    }
    if (empty($errors)) {
        // Edit
        if (!empty($aFields['zoneid'])) {
            // before we commit any changes to db, store whether the size has changed
            $aZone = Admin_DA::getZone($aFields['zoneid']);
            $size_changed = $aFields['width'] != $aZone['width'] || $aFields['height'] != $aZone['height'] ? true : false;
            $type_changed = $aFields['delivery'] != $aZone['delivery'] ? true : false;
            $doZones = OA_Dal::factoryDO('zones');
            $doZones->zonename = $aFields['zonename'];
            $doZones->description = $aFields['description'];
            $doZones->width = $aFields['width'];
            $doZones->height = $aFields['height'];
            $doZones->comments = $aFields['comments'];
            $doZones->delivery = $aFields['delivery'];
            if ($aFields['delivery'] != phpAds_ZoneText && $aFields['delivery'] != phpAds_ZoneBanner) {
                $doZones->append = '';
            }
            if ($aFields['delivery'] != phpAds_ZoneText) {
                $doZones->prepend = '';
            }
            $doZones->oac_category_id = $aFields['oac_category_id'];
            $doZones->zoneid = $aFields['zoneid'];
            $doZones->update();
            // Ad  Networks
            $doPublisher = OA_Dal::factoryDO('affiliates');
            $doPublisher->get($aFields['affiliateid']);
            $anWebsiteId = $doPublisher->as_website_id;
            if ($anWebsiteId) {
                $oAdNetworks = new OA_Central_AdNetworks();
                $doZones->get($aFields['zoneid']);
                $oAdNetworks->updateZone($doZones, $anWebsiteId);
            }
            // Reset append codes which called this zone
            $doZones = OA_Dal::factoryDO('zones');
            $doZones->appendtype = phpAds_ZoneAppendZone;
            if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
                $doZones->addReferenceFilter('agency', OA_Permission::getEntityId());
            } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
                $doZones->addReferenceFilter('affiliates', OA_Permission::getEntityId());
            }
            $doZones->find();
            while ($doZones->fetch() && ($row = $doZones->toArray())) {
                $append = phpAds_ZoneParseAppendCode($row['append']);
                if ($append[0]['zoneid'] == $aFields['zoneid']) {
                    $doZonesClone = clone $doZones;
                    $doZonesClone->appendtype = phpAds_ZoneAppendRaw;
                    $doZonesClone->append = '';
                    $doZonesClone->update();
                }
            }
            if ($type_changed && $aFields['delivery'] == MAX_ZoneEmail) {
                // Unlink all campaigns/banners linked to this zone
                $aPlacementZones = Admin_DA::getPlacementZones(array('zone_id' => $aFields['zoneid']), true, 'placement_id');
                if (!empty($aPlacementZones)) {
                    foreach ($aPlacementZones as $placementId => $aPlacementZone) {
                        Admin_DA::deletePlacementZones(array('zone_id' => $aFields['zoneid'], 'placement_id' => $placementId));
                    }
                }
                $aAdZones = Admin_DA::getAdZones(array('zone_id' => $aFields['zoneid']), false, 'ad_id');
                if (!empty($aAdZones)) {
                    foreach ($aAdZones as $adId => $aAdZone) {
                        Admin_DA::deleteAdZones(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId));
                    }
                }
            } else {
                if ($size_changed) {
                    $aZone = Admin_DA::getZone($aFields['zoneid']);
                    // Loop through all appended banners and make sure that they still fit...
                    $aAds = Admin_DA::getAdZones(array('zone_id' => $aFields['zoneid']), false, 'ad_id');
                    if (!empty($aAds)) {
                        foreach ($aAds as $adId => $aAd) {
                            $aAd = Admin_DA::getAd($adId);
                            if ($aZone['type'] == phpAds_ZoneText && $aAd['type'] != 'txt' || $aAd['width'] != $aZone['width'] && $aZone['width'] > -1 || $aAd['height'] != $aZone['height'] && $aZone['height'] > -1) {
                                Admin_DA::deleteAdZones(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId));
                            }
                        }
                    }
                    // Check if any campaigns linked to this zone have ads that now fit.
                    // If so, link them to the zone.
                    $aPlacementZones = Admin_DA::getPlacementZones(array('zone_id' => $aFields['zoneid']), true);
                    if (!empty($aPlacementZones)) {
                        foreach ($aPlacementZones as $aPlacementZone) {
                            // get ads in this campaign
                            $aAds = Admin_DA::getAds(array('placement_id' => $aPlacementZone['placement_id']), true);
                            foreach ($aAds as $adId => $aAd) {
                                Admin_DA::addAdZone(array('zone_id' => $aFields['zoneid'], 'ad_id' => $adId));
                            }
                        }
                    }
                }
            }
            // Queue confirmation message
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strZoneHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "zone-edit.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']), htmlspecialchars($aFields['zonename'])));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            OX_Admin_Redirect::redirect("zone-edit.php?affiliateid=" . $aFields['affiliateid'] . "&zoneid=" . $aFields['zoneid']);
        } else {
            $doZones = OA_Dal::factoryDO('zones');
            $doZones->affiliateid = $aFields['affiliateid'];
            $doZones->zonename = $aFields['zonename'];
            $doZones->zonetype = phpAds_ZoneCampaign;
            $doZones->description = $aFields['description'];
            $doZones->comments = $aFields['comments'];
            $doZones->width = $aFields['width'];
            $doZones->height = $aFields['height'];
            $doZones->delivery = $aFields['delivery'];
            $doZones->oac_category_id = $aFields['oac_category_id'];
            // The following fields are NOT NULL but do not get values set in the form.
            // Should these fields be changed to NULL in the schema or should they have a default value?
            $doZones->category = '';
            $doZones->ad_selection = '';
            $doZones->chain = '';
            $doZones->prepend = '';
            $doZones->append = '';
            $aFields['zoneid'] = $doZones->insert();
            // Ad  Networks
            $doPublisher = OA_Dal::factoryDO('affiliates');
            $doPublisher->get($aFields['affiliateid']);
            $anWebsiteId = $doPublisher->as_website_id;
            if ($anWebsiteId) {
                $oAdNetworks = new OA_Central_AdNetworks();
                $oAdNetworks->updateZone($doZones, $anWebsiteId);
            }
            // Queue confirmation message
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strZoneHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'zone-edit.php?affiliateid=' . $aFields['affiliateid'] . '&zoneid=' . $aFields['zoneid']), htmlspecialchars($aFields['zonename'])));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            OX_Admin_Redirect::redirect("affiliate-zones.php?affiliateid=" . $aFields['affiliateid']);
        }
    }
    return $errors;
}
コード例 #18
0
 /**
  * A private method to obtain the tracker variable details for conversions
  * found in the {@link Plugins_Reports_Standard_ConversionTrackingReport::_prepareConnections()}
  * method
  *
  * @access private
  * @param array $aConnections An array, indexed by tracker ID, of conversion data. The
  *                            index keys (ie. the tracker IDs) are all that are relevant
  *                            to this method.
  * @return array An array with the following format:
  *      array(
  *          $trackerId => array(
  *              'tracker_id'   => Integer: The tracker ID
  *              'tracker_name' => String:  The tracker name
  *              'variables'    => array(
  *                  $trackerVariableId => array(
  *                      tracker_variable_id          => Integer: The variable ID
  *                      tracker_variable_name        => String:  The variable name
  *                      tracker_variable_description => String:  The variable description
  *                      tracker_variable_data_type   =>
  *                      tracker_variable_purpose     =>
  *                      tracker_variable_is_unique   =>
  *                      tracker_variable_hidden      => String:  Either 't' or 'f'
  *              )
  *          )
  *      )
  *
  */
 function _prepareTrackerVariables($aConnections)
 {
     $aTrackerVariables = array();
     $aConf = $GLOBALS['_MAX']['CONF'];
     // If the user is a publisher, set the publisher ID
     if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $publisherId = OA_Permission::getEntityId();
     } else {
         $publisherId = 0;
     }
     // Prepare the query to select the required tracker variable values
     $trackerIds = implode(',', array_keys($aConnections));
     // Query Data Base only if there are connections
     if (!empty($trackerIds)) {
         $query = "\n                SELECT\n                    t.trackerid AS tracker_id,\n                    t.trackername AS tracker_name,\n                    v.variableid AS tracker_variable_id,\n                    v.name AS tracker_variable_name,\n                    v.description AS tracker_variable_description,\n                    v.datatype AS tracker_variable_data_type,\n                    v.purpose AS tracker_variable_purpose,\n                    v.is_unique AS tracker_variable_is_unique,\n                    v.hidden AS tracker_variable_hidden,\n                    vp.visible AS tracker_variable_visible\n                FROM\n                    {$aConf['table']['prefix']}{$aConf['table']['trackers']} AS t\n                LEFT JOIN\n                    {$aConf['table']['prefix']}{$aConf['table']['variables']} AS v\n                ON\n                    (\n                        t.trackerid = v.trackerid\n                    )\n                LEFT JOIN\n                    {$aConf['table']['prefix']}{$aConf['table']['variable_publisher']} AS vp\n                ON\n                    (\n                        v.variableid = vp.variable_id\n                        AND\n                        vp.publisher_id = {$publisherId}\n                    )\n                WHERE\n                    t.trackerid IN ( " . $trackerIds . ")\n                ORDER BY\n                    tracker_id";
         // Select the tracker variables needed for the report
         $rsTrackerVariables = DBC::NewRecordSet($query);
         $rsTrackerVariables->find();
         while ($rsTrackerVariables->fetch()) {
             $aTrackerVariable = $rsTrackerVariables->toArray();
             $trackerId = $aTrackerVariable['tracker_id'];
             // Is the tracker already set in the array?
             // It might be, in the case of a tracker having multiple variables...
             if (!isset($aTrackerVariables[$trackerId])) {
                 // It's not set, store the tracker ID and name
                 $aTrackerVariables[$trackerId]['tracker_id'] = $trackerId;
                 $aTrackerVariables[$trackerId]['tracker_name'] = $aTrackerVariable['tracker_name'];
             }
             // Store the variable associated with this tracker, if one exists
             $trackerVariableId = $aTrackerVariable['tracker_variable_id'];
             if (!empty($trackerVariableId)) {
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_id'] = $trackerVariableId;
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_name'] = $aTrackerVariable['tracker_variable_name'];
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_description'] = $aTrackerVariable['tracker_variable_description'];
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_data_type'] = $aTrackerVariable['tracker_variable_data_type'];
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_purpose'] = $aTrackerVariable['tracker_variable_purpose'];
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_is_unique'] = $aTrackerVariable['tracker_variable_is_unique'];
                 $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_hidden'] = $aTrackerVariable['tracker_variable_hidden'];
                 if (!is_null($aTrackerVariable['tracker_variable_visible'])) {
                     $aTrackerVariables[$trackerId]['variables'][$trackerVariableId]['tracker_variable_hidden'] = $aTrackerVariable['tracker_variable_visible'] ? 'f' : 't';
                 }
             }
         }
     }
     return $aTrackerVariables;
 }
コード例 #19
0
ファイル: ChannelIdField.php プロジェクト: villos/tree_admin
 function getChannels()
 {
     global $list_filters;
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
         // set publisher id if list is to be filtered by publisher
         if (isset($list_filters['publisher'])) {
             $aParams = array('publisher_id' => $list_filters['publisher']);
             // get channels owned by this publisher's agency
             $aPublisher = Admin_DA::getPublisher($list_filters['publisher']);
             $agencyId = $aPublisher['agency_id'];
             if ($agencyId != 0) {
                 // check that this publisher actually has an agency
                 $aParams2 = array('agency_id' => $agencyId, 'publisher_id' => 0);
                 $aAgencyChannels = Admin_DA::getChannels($aParams2);
             }
         }
         $aChannels = Admin_DA::getChannels($aParams);
         // add any agency-owned channels
         if (isset($aAgencyChannels)) {
             foreach ($aAgencyChannels as $channelId => $aAgencyChannel) {
                 $aChannels[$channelId] = $aAgencyChannel;
             }
         }
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $aParams = array('agency_id' => OA_Permission::getEntityId());
         // set publisher id if list is to be filtered by publisher
         if (isset($list_filters['publisher'])) {
             $aParams = array('agency_id' => OA_Permission::getEntityId(), 'publisher_id' => $list_filters['publisher']);
         }
         $aChannels = Admin_DA::getChannels($aParams);
         // add agency-owned channels
         $aParams = array('agency_id' => OA_Permission::getEntityId(), 'publisher_id' => 0);
         $aAgencyChannels = Admin_DA::getChannels($aParams);
         foreach ($aAgencyChannels as $channelId => $aAgencyChannel) {
             $aChannels[$channelId] = $aAgencyChannel;
         }
     } 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)));
         $aChannels = Admin_DA::getChannels($aParams);
         // get channels owned by this publisher's agency
         $aPublisher = Admin_DA::getPublisher(OA_Permission::getEntityId());
         $agencyId = $aPublisher['agency_id'];
         if ($agencyId != 0) {
             // check that this publisher actually has an agency
             $aParams2 = array('agency_id' => $agencyId, 'publisher_id' => 0);
             $aAgencyChannels = Admin_DA::getChannels($aParams2);
         }
         // add agency-owned channels
         if (isset($aAgencyChannels)) {
             foreach ($aAgencyChannels as $channelId => $aAgencyChannel) {
                 $aChannels[$channelId] = $aAgencyChannel;
             }
         }
     } else {
         $aPublishers = array();
         $aChannels = array();
     }
     // add admin-owned channels
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER) || OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         // add admin-owned channels
         $aParams = array('agency_id' => 0, 'publisher_id' => 0);
         $aAdminChannels = Admin_DA::getChannels($aParams);
         foreach ($aAdminChannels as $channelId => $aAdminChannel) {
             $aChannels[$channelId] = $aAdminChannel;
         }
     }
     $aChannelArray = array();
     foreach ($aChannels as $channelId => $aChannel) {
         $aChannelArray[$channelId] = phpAds_buildName($channelId, $aChannel['name']);
     }
     return $aChannelArray;
 }
コード例 #20
0
function displayPage($bannerid, $campaignid, $clientid, $bannerTypes, $aBanner, $type, $form, $ext_bannertype, $formDisabled = false)
{
    $pageName = 'advertiser-campaigns';
    $aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);
    $entityId = OA_Permission::getEntityId();
    $entityType = 'advertiser_id';
    $aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId));
    $aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);
    $advertiserId = $aEntities['clientid'];
    $campaignId = $aEntities['campaignid'];
    $bannerId = $aEntities['bannerid'];
    $entityString = _getEntityString($aEntities);
    $aOtherEntities = $aEntities;
    unset($aOtherEntities['bannerid']);
    $otherEntityString = _getEntityString($aOtherEntities);
    if ($pageName == 'banner-edit.php' && empty($bannerId)) {
        $tabValue = 'banner-edit_new';
        $pageType = 'edit-new';
    } else {
        $pageType = 'edit';
    }
    $advertiserEditUrl = '';
    $campaignEditUrl = '';
    if (OA_Permission::hasAccessToObject('clients', $advertiserId)) {
        $advertiserEditUrl = "advertiser-edit.php?clientid={$advertiserId}";
    }
    if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
        $campaignEditUrl = "campaign-edit.php?clientid={$advertiserId}&campaignid={$campaignId}";
    }
    if ($bannerId && !empty($GLOBALS['_MAX']['PREF']['ui_show_banner_preview']) && empty($_GET['nopreview'])) {
        require_once MAX_PATH . '/lib/max/Delivery/adRender.php';
        $aBanner = Admin_DA::getAd($bannerId);
        $aBanner['storagetype'] = $aBanner['type'];
        $aBanner['bannerid'] = $aBanner['ad_id'];
        $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false);
    } else {
        $bannerCode = '';
    }
    $advertiserDetails = phpAds_getClientDetails($advertiserId);
    $advertiserName = $advertiserDetails['clientname'];
    $campaignDetails = Admin_DA::getPlacement($campaignId);
    $campaignName = $campaignDetails['name'];
    $bannerName = $aOtherBanners[$bannerId]['name'];
    $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder();
    $oHeaderModel = $builder->buildEntityHeader(array(array("name" => $advertiserName, "url" => $advertiserEditUrl), array("name" => $campaignName, "url" => $campaignEditUrl), array("name" => $bannerName)), "banner", $pageType);
    global $phpAds_breadcrumbs_extra;
    $phpAds_breadcrumbs_extra .= "<div class='bannercode'>{$bannerCode}</div>";
    if ($bannerCode != '') {
        $phpAds_breadcrumbs_extra .= "<br />";
    }
    addPageLinkTool($GLOBALS["strDuplicate"], MAX::constructUrl(MAX_URL_ADMIN, "plugins/oxMarkedTextAdvertiser/banner-modify.php?duplicate=true&clientid={$advertiserId}&campaignid={$campaignId}&bannerid={$bannerId}&returnurl=" . urlencode(basename($_SERVER['SCRIPT_NAME']))), "iconBannerDuplicate");
    addPageShortcut($GLOBALS['strBackToBanners'], MAX::constructUrl(MAX_URL_ADMIN, "campaign-banners.php?clientid={$advertiserId}&campaignid={$campaignId}"), "iconBack");
    $entityString = _getEntityString($aEntities);
    addPageShortcut($GLOBALS['strBannerHistory'], MAX::constructUrl(MAX_URL_ADMIN, "stats.php?entity=banner&breakdown=history&{$entityString}"), 'iconStatistics');
    phpAds_PageHeader('advertiser-campaigns', $oHeaderModel);
    $oTpl = new OA_Admin_Template('banner-edit.html');
    $oTpl->assign('clientId', $clientid);
    $oTpl->assign('campaignId', $campaignid);
    $oTpl->assign('bannerId', $bannerid);
    $oTpl->assign('bannerTypes', $bannerTypes);
    $oTpl->assign('bannerType', 'bannerTypeText:oxMarkedText:oxMarkedTextComponent');
    $oTpl->assign('bannerHeight', $aBanner["height"]);
    $oTpl->assign('bannerWidth', $aBanner["width"]);
    $oTpl->assign('disabled', $formDisabled);
    $oTpl->assign('form', $form->serialize());
    $oTpl->display();
    phpAds_PageFooter();
}
コード例 #21
0
 /**
  * PHP4 constructor
  */
 function Admin_UI_OrganisationScope()
 {
     $this->_publisherId = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : false;
     $this->_advertiserId = OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) ? OA_Permission::getEntityId() : false;
     $this->_agencyId = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? false : OA_Permission::getAgencyId();
 }
コード例 #22
0
ファイル: channel-index.php プロジェクト: villos/tree_admin
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA |
+---------------------------------------------------------------------------+
$Id: channel-index.php 37157 2009-05-28 12:31:10Z andrew.hill $
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-statistics.inc.php';
require_once MAX_PATH . '/lib/max/other/html.php';
// Register input variables
phpAds_registerGlobal('acl', 'action', 'submit');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
// Initialise some parameters
$pageName = basename($_SERVER['PHP_SELF']);
$agencyId = OA_Permission::getEntityId();
$tabindex = 1;
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageHeader("5.7");
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
echo "<img src='" . OX::assetPath() . "/images/icon-channel-add.gif' border='0' align='absmiddle'>&nbsp;";
echo "<a href='channel-edit.php?agencyid={$agencyId}' accesskey='" . $keyAddNew . "'>{$GLOBALS['strAddNewChannel_Key']}</a>&nbsp;&nbsp;";
phpAds_ShowBreak();
$channels = Admin_DA::getChannels(array('agency_id' => $agencyId), true);
MAX_displayChannels($channels, array('agencyid' => $agencyId));
phpAds_PageFooter();
コード例 #23
0
ファイル: banner-acl.php プロジェクト: villos/tree_admin
            $values['updated'] = $now;
            $doBanners->setFrom($values);
            $doBanners->update();
        }
        // Queue confirmation message
        $translation = new OX_Translation();
        $translated_message = $translation->translate($GLOBALS['strBannerAclHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid), htmlspecialchars($doBanners->description)));
        OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
        header("Location: banner-acl.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}");
        exit;
    }
}
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
$entityId = OA_Permission::getEntityId();
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
    $entityType = 'advertiser_id';
} else {
    $entityType = 'agency_id';
}
// Display navigation
$aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId));
$aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);
// Setup a fake record for the "Apply to all" entry
$aOtherBanners[-1] = array('name' => '--' . $GLOBALS['strAllBannersInCampaign'] . '--', 'ad_id' => -1, 'placement_id' => $campaignid);
MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
$aBanner = MAX_cacheGetAd($bannerid, false);
コード例 #24
0
ファイル: index.php プロジェクト: villos/tree_admin
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/OA/Permission.php';
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER);
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
    // Show Dashboard if Dashboard is enabled
    if ($GLOBALS['_MAX']['CONF']['ui']['dashboardEnabled']) {
        OX_Admin_Redirect::redirect('dashboard.php');
    } else {
        OX_Admin_Redirect::redirect('agency-index.php');
    }
}
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
    // Show Dashboard if Dashboard is enabled, Sync is enabled and PHP is SSL enabled
    if ($GLOBALS['_MAX']['CONF']['ui']['dashboardEnabled'] && $GLOBALS['_MAX']['CONF']['sync']['checkForUpdates'] && OA::getAvailableSSLExtensions()) {
        OX_Admin_Redirect::redirect('dashboard.php');
    } else {
        OX_Admin_Redirect::redirect('advertiser-index.php');
    }
}
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
    OX_Admin_Redirect::redirect('stats.php?entity=advertiser&breakdown=history&clientid=' . OA_Permission::getEntityId());
}
if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
    OX_Admin_Redirect::redirect('stats.php?entity=affiliate&breakdown=history&affiliateid=' . OA_Permission::getEntityId());
}
コード例 #25
0
    foreach ($aAdvertiserList as $key => $aValue) {
        $aAdvertiser[$aValue['advertiser_id']] = $aValue['name'];
    }
    $aCampaign = array();
    if (!empty($advertiserId)) {
        $campaign = Admin_DA::getCampaigns(array('client_id' => $advertiserId));
        $aCampaign[0] = $GLOBALS['strSelectPlacement'];
        foreach ($campaign as $key => $aValue) {
            $aCampaign[$aValue['campaign_id']] = $aValue['campaignname'];
        }
    }
}
// Get publishers if we show them
if ($showPublishers) {
    if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
        $tempPublisherId = OA_Permission::getEntityId();
        $aPublisherList = Admin_DA::getPublishers(array('publisher_id' => $tempPublisherId));
    } else {
        $aPublisherList = Admin_DA::getPublishers(array('agency_id' => $agencyId));
    }
    $aPublisher[0] = $GLOBALS['strSelectPublisher'];
    foreach ($aPublisherList as $key => $aValue) {
        $aPublisher[$aValue['publisher_id']] = $aValue['name'];
    }
    if (!empty($publisherId)) {
        $zone = Admin_DA::getZones(array('publisher_id' => $publisherId));
        $aZone[0] = $GLOBALS['strSelectZone'];
        foreach ($zone as $key => $aValue) {
            $aZone[$aValue['zone_id']] = $aValue['name'];
        }
    }
コード例 #26
0
function getAdvertiserMap()
{
    $doClients = OA_Dal::factoryDO('clients');
    // Unless admin, restrict results shown.
    if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
        $doClients->clientid = OA_Permission::getEntityId();
    } else {
        $doClients->agencyid = OA_Permission::getEntityId();
    }
    //$doClients->addSessionListOrderBy('advertiser-index.php');
    $doClients->find();
    $aAdvertiserMap = array();
    while ($doClients->fetch() && ($row = $doClients->toArray())) {
        $aAdvertiserMap[$row['clientid']] = array('name' => $row['clientname'], 'url' => "advertiser-campaigns.php?clientid=" . $row['clientid']);
    }
    return $aAdvertiserMap;
}
コード例 #27
0
ファイル: channel-edit.php プロジェクト: villos/tree_admin
$doChannel = OA_Dal::factoryDO('channel');
if (!empty($channelid)) {
    $doChannel->get($channelid);
    $channel = $doChannel->toArray();
} else {
    //for new channels set affiliate id (if any)
    if (!empty($affiliateid)) {
        OA_Permission::enforceAccessToObject('affiliates', $affiliateid);
        $channel['affiliateid'] = $affiliateid;
    }
}
if (!empty($affiliateid)) {
    /*-------------------------------------------------------*/
    /* Store preferences									 */
    /*-------------------------------------------------------*/
    $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['affiliateid'] = $affiliateid;
    phpAds_SessionDataStore();
}
/*-------------------------------------------------------*/
/* MAIN REQUEST PROCESSING                               */
/*-------------------------------------------------------*/
//build form
$channelForm = buildChannelForm($channel);
if ($channelForm->validate()) {
    //process submitted values
    processForm($channelForm);
} else {
    //either validation failed or form was not submitted, display the form
    displayPage($channel, $channelForm);
}
/*-------------------------------------------------------*/
コード例 #28
0
// @todo: hack - get edit status working when expading/collapsing
if ($editStatuses) {
    $entityIds['editStatuses'] = 1;
    $addUrl .= '&editStatuses=1';
}
// Display navigation
if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
    // Navigation for publisher
    $conf =& $GLOBALS['_MAX']['CONF'];
    $conf['logging']['adRequests'] = false;
    $affiliateid = OA_Permission::getEntityId();
    phpAds_PageHeader("1.1");
    echo '<br><br>';
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
    // Navigation for advertiser
    $clientid = OA_Permission::getEntityId();
    phpAds_PageHeader("1.1");
    echo '<br><br>';
} else {
    // Navigation for admin and agency
    phpAds_PageHeader("2.1");
    echo '<br><br>';
}
// Initialise some parameters
$pageName = basename($_SERVER['SCRIPT_NAME']);
$tabindex = 1;
$advertisersHidden = 0;
// Display date filter form
if (empty($day)) {
    $aDates = MAX_getDatesByPeriod($period_preset, $period_start, $period_end);
} else {
コード例 #29
0
 /**
  * Returns an array of variables connected to specific connection.
  *
  * @param array $aParams
  * @return array
  */
 function getConnectionVariables($connectionId)
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $where = '';
     if (empty($connectionId)) {
         return false;
     } else {
         $connectionId = (int) $connectionId;
     }
     if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $publisherId = OA_Permission::getEntityId();
     } else {
         $publisherId = 0;
     }
     $query = "SELECT\n            v.variableid,\n            v.name,\n            v.description,\n            vv.value,\n            v.purpose,\n            v.hidden,\n            vp.visible\n        FROM\n            {$conf['table']['prefix']}{$conf['table']['variables']} AS v JOIN\n            {$conf['table']['prefix']}{$conf['table']['data_intermediate_ad_variable_value']} AS vv ON (vv.tracker_variable_id = v.variableid) LEFT JOIN\n            {$conf['table']['prefix']}{$conf['table']['variable_publisher']} AS vp ON (vp.variable_id =  v.variableid AND vp.publisher_id = {$publisherId})\n        WHERE\n            vv.data_intermediate_ad_connection_id='" . DBC::makeLiteral($connectionId) . "'\n        ORDER BY\n            v.name";
     $rsVariables = DBC::NewRecordSet($query);
     if (!$rsVariables->find()) {
         return false;
     }
     $aDataVariables = array();
     while ($rsVariables->fetch()) {
         $dataVariable = $rsVariables->toArray();
         if (!is_null($dataVariable['visible'])) {
             $dataVariable['hidden'] = $dataVariable['visible'] ? 'f' : 't';
         }
         unset($dataVariable['visible']);
         $aDataVariables[$dataVariable['variableid']] = $dataVariable;
     }
     return $aDataVariables;
 }
コード例 #30
0
 function display()
 {
     $name = $this->_name;
     $oScope = $this->_value;
     $hasAnonymousCampaigns = $this->_hasAnonymousCampaigns($aParams);
     $aAdvertisers = $this->_getAdvertisers();
     if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $advertiserId = OA_Permission::getEntityId();
         echo "\n        <input type='hidden' name='{$name}_advertiser' id='{$name}_advertiser' value='{$advertiserId}'>";
     } else {
         echo "\n        <select name='{$name}_advertiser' id='{$name}_advertiser' tabindex='" . $this->_tabIndex++ . "'>\n            <option value='all'>-- {$GLOBALS['strAllAdvertisers']} --</option>";
         if ($hasAnonymousCampaigns) {
             echo "\n            <option value='anon'>-- {$GLOBALS['strAnonAdvertisers']} --</option>";
         }
         foreach ($aAdvertisers as $advertiserId => $aAdvertiser) {
             $selected = $advertiserId == $oScope->_advertiserId ? " selected='selected'" : '';
             echo "\n            <option value='{$advertiserId}'{$selected}>" . htmlspecialchars($aAdvertiser['name']) . "</option>";
         }
         echo "\n        </select>";
     }
     if (!OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) && !OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         echo "\n        <br /><br />";
     }
     $aPublishers = $this->_getPublishers();
     if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         echo "\n        <input type='hidden' name='{$name}_publisher' id='{$name}_publisher' value='{$publisherId}'>";
     } else {
         echo "\n        <select name='{$name}_publisher' id='{$name}_publisher' tabindex='" . $this->_tabIndex++ . "'>\n            <option value='all'>-- {$GLOBALS['strAllPublishers']} --</option>";
         if ($hasAnonymousCampaigns) {
             echo "\n            <option value='anon'>-- {$GLOBALS['strAnonPublishers']} --</option>";
         }
         foreach ($aPublishers as $publisherId => $aPublisher) {
             $selected = $publisherId == $oScope->_publisherId ? " selected='selected'" : '';
             echo "\n            <option value='{$publisherId}'{$selected}>" . htmlspecialchars($aPublisher['name']) . "</option>";
         }
         echo "\n        </select>";
     }
 }