示例#1
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;
 }
/*********************************************************/
if (phpAds_isUser(phpAds_Admin)) {
    if (isset($Session['prefs']['affiliate-index.php']['listorder'])) {
        $navorder = $Session['prefs']['affiliate-index.php']['listorder'];
    } else {
        $navorder = '';
    }
    if (isset($Session['prefs']['affiliate-index.php']['orderdirection'])) {
        $navdirection = $Session['prefs']['affiliate-index.php']['orderdirection'];
    } else {
        $navdirection = '';
    }
    // Get other affiliates
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_affiliates'] . "\n\t\t" . phpAds_getAffiliateListOrder($navorder, $navdirection) . "\n\t") or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        phpAds_PageContext(phpAds_buildAffiliateName($row['affiliateid'], $row['name']), "affiliate-zones.php?affiliateid=" . $row['affiliateid'], $affiliateid == $row['affiliateid']);
    }
    phpAds_PageShortcut($strAffiliateHistory, 'stats-affiliate-history.php?affiliateid=' . $affiliateid, 'images/icon-statistics.gif');
    phpAds_PageHeader("4.2.3");
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>";
    phpAds_ShowSections(array("4.2.2", "4.2.3"));
} else {
    $sections[] = "2.1";
    if (phpAds_isAllowed(phpAds_ModifyInfo)) {
        $sections[] = "2.2";
    }
    phpAds_PageHeader("2.1");
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>";
    phpAds_ShowSections($sections);
}
/*********************************************************/
    $extra .= "<b>{$strModifyZone}</b><br>";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
    $extra .= "<img src='images/icon-duplicate-zone.gif' align='absmiddle'>&nbsp;<a href='zone-modify.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&duplicate=true&returnurl=zone-advanced.php'>{$strDuplicate}</a><br>";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
    $extra .= "<img src='images/icon-move-zone.gif' align='absmiddle'>&nbsp;{$strMoveTo}<br>";
    $extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>";
    $extra .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $extra .= "<select name='moveto' style='width: 110;'>";
    if (phpAds_isUser(phpAds_Admin)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid != " . $affiliateid;
    } elseif (phpAds_isUser(phpAds_Agency)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid != " . $affiliateid . " AND agencyid=" . phpAds_getUserID();
    }
    $res = phpAds_dbQuery($query) or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        $extra .= "<option value='" . $row['affiliateid'] . "'>" . phpAds_buildAffiliateName($row['affiliateid'], $row['name']) . "</option>";
    }
    $extra .= "</select>&nbsp;<input type='image' src='images/" . $phpAds_TextDirection . "/go_blue.gif'><br>";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
    $extra .= "<img src='images/icon-recycle.gif' align='absmiddle'>&nbsp;<a href='zone-delete.php?affiliateid={$affiliateid}&zoneid={$zoneid}&returnurl=affiliate-zones.php'" . phpAds_DelConfirm($strConfirmDeleteZone) . ">{$strDelete}</a><br>";
    $extra .= "</form>";
    phpAds_PageHeader("4.2.3.6", $extra);
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;" . phpAds_getAffiliateName($affiliateid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getZoneName($zoneid) . "</b><br><br><br>";
    phpAds_ShowSections(array("4.2.3.2", "4.2.3.6", "4.2.3.3", "4.2.3.4", "4.2.3.5"));
} else {
    $sections[] = "2.1.2";
    $sections[] = "2.1.6";
    if (phpAds_isAllowed(phpAds_LinkBanners)) {
        $sections[] = "2.1.3";
示例#4
0
 /**
  * Gets list of other publishers and set a menu page context variable with them
  * Can be easily reused across inventory->publishers pages
  *
  * TODO: Consider reading page name from automatically instead of passing it as a parameter
  *
  * @static
  * @param integer $affiliateid  Affiliate ID
  * @param string $pageName
  * @param string $sortPageName
  */
 function setPublisherPageContext($affiliateid, $pageName, $sortPageName = 'website-index.php')
 {
     $doAffiliates = OA_Dal::factoryDO('affiliates');
     $doAffiliates->agencyid = OA_Permission::getAgencyId();
     if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $doAffiliates->affiliateid = $affiliateid;
     }
     $doAffiliates->addSessionListOrderBy($sortPageName);
     $doAffiliates->find();
     while ($doAffiliates->fetch()) {
         phpAds_PageContext(phpAds_buildAffiliateName($doAffiliates->affiliateid, $doAffiliates->name), "{$pageName}?affiliateid=" . $doAffiliates->affiliateid, $affiliateid == $doAffiliates->affiliateid);
     }
 }
phpAds_registerGlobal('period', 'start', 'limit', 'source');
// Security check
phpAds_checkAccess(phpAds_Admin + phpAds_Affiliate);
/*********************************************************/
/* Affiliate interface security                          */
/*********************************************************/
if (phpAds_isUser(phpAds_Affiliate)) {
    $affiliateid = phpAds_getUserID();
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (phpAds_isUser(phpAds_Admin)) {
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_affiliates'] . "\n\t") or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        phpAds_PageContext(phpAds_buildAffiliateName($row['affiliateid'], $row['name']), "stats-affiliate-history.php?affiliateid=" . $row['affiliateid'], $affiliateid == $row['affiliateid']);
    }
    phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
    phpAds_PageHeader("2.4.1");
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>";
    phpAds_ShowSections(array("2.4.1", "2.4.2"));
} else {
    phpAds_PageHeader("1.2");
    if ($phpAds_config['client_welcome']) {
        echo "<br><br>";
        // Show welcome message
        if (!empty($phpAds_client_welcome_msg)) {
            echo $phpAds_client_welcome_msg;
        } else {
            include 'templates/welcome-publisher.html';
        }
function phpAds_getAffiliateArray()
{
    global $phpAds_config;
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_affiliates'] . "\n\t");
    while ($row = phpAds_dbFetchArray($res)) {
        $affiliateArray[$row['affiliateid']] = phpAds_buildAffiliateName($row['affiliateid'], $row['name']);
    }
    return $affiliateArray;
}
function phpAds_getKeywordsArray()
{
    global $phpAds_config;
    if (phpAds_isUser(phpAds_Admin)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'];
    } elseif (phpAds_isUser(phpAds_Agency)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . phpAds_getUserID();
    } elseif (phpAds_isUser(phpAds_Client)) {
        $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid=" . phpAds_getUserID();
    }
    $res = phpAds_dbQuery($query);
    while ($row = phpAds_dbFetchArray($res)) {
        $affiliateArray[$row['affiliateid']] = phpAds_buildAffiliateName($row['affiliateid'], $row['name']);
    }
    return $affiliateArray;
}