/**
  * The logoff method logs a user off from a service and ends the session
  * or returns an error message.
  *
  * @access public
  *
  * @param XML_RPC_Message &$oParams
  *
  * @return generated result (data or error)
  */
 function logoff(&$oParams)
 {
     $sessionId = null;
     $oResponseWithError = null;
     if (!XmlRpcUtils::getRequiredScalarValue($sessionId, $oParams, 0, $oResponseWithError)) {
         return $oResponseWithError;
     }
     if ($this->logonServiceImp->logoff($sessionId)) {
         return XmlRpcUtils::booleanTypeResponse(true);
     } else {
         return XmlRpcUtils::generateError($this->logonServiceImp->getLastError());
     }
 }
 /**
  * The getCampaignListByAdvertiserIdPagination method returns a list of campaigns
  * for an advertiser with limit and offset, or returns an error message.
  *
  * @access public
  *
  * @param XML_RPC_Message &$oParams
  *
  * @return generated result (data or error)
  */
 function getCampaignListByAdvertiserIdPagination(&$oParams)
 {
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$advertiserId, &$limit, &$offset), array(true, true, false, false), $oParams, $oResponseWithError)) {
         return $oResponseWithError;
     }
     $aCampaignList = null;
     if ($this->_oCampaignServiceImpl->getCampaignListByAdvertiserIdPagination($sessionId, $advertiserId, $limit, $offset, $aCampaignList)) {
         return XmlRpcUtils::getArrayOfEntityResponse($aCampaignList);
     } else {
         return XmlRpcUtils::generateError($this->_oCampaignServiceImpl->getLastError());
     }
 }
 /**
  * The getPublisherListByAgencyId method returns a list of publishers
  * for an agency, or returns an error message.
  *
  * @access public
  *
  * @param XML_RPC_Message $oParams
  *
  * @return generated result (data or error)
  */
 function getPublisherListByAgencyId($oParams)
 {
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$agencyId), array(true, true), $oParams, $oResponseWithError)) {
         return $oResponseWithError;
     }
     $aPublisherList = null;
     if ($this->_oPublisherServiceImp->getPublisherListByAgencyId($sessionId, $agencyId, $aPublisherList)) {
         return XmlRpcUtils::getArrayOfEntityResponse($aPublisherList);
     } else {
         return XmlRpcUtils::generateError($this->_oPublisherServiceImp->getLastError());
     }
 }
 function updateUserEmailBySsoId($oParams)
 {
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$ssoUserId, &$email), array(true, true, true), $oParams, $oResponseWithError)) {
         return $oResponseWithError;
     }
     if ($this->_oUserServiceImp->updateUserEmailBySsoId($sessionId, $ssoUserId, $email)) {
         return XmlRpcUtils::booleanTypeResponse(true);
     } else {
         return XmlRpcUtils::generateError($this->_oUserServiceImp->getLastError());
     }
 }
 function generateTags($oParams)
 {
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$zoneId, &$codeType, &$aParams), array(true, true, true, false), $oParams, $oResponseWithError)) {
         return $oResponseWithError;
     }
     if ($this->_oZoneServiceImp->generateTags($sessionId, $zoneId, $codeType, $aParams, $generatedTag)) {
         return XmlRpcUtils::stringTypeResponse($generatedTag);
     } else {
         return XmlRpcUtils::generateError($this->_oZoneServiceImp->getLastError());
     }
 }
 /**
  * Gets Structure Non Scalar field from XML RPC Value parameter
  *
  * @access private
  *
  * @param structure &$oStructure  to return data
  * @param XML_RPC_Value $oStructParam
  * @param string $fieldName
  * @param XML_RPC_Response &$responseWithError
  *
  * @return boolean  shows true if method was executed successfully
  */
 function _getStructureNonScalarField(&$oStructure, &$oStructParam, $fieldName, &$oResponseWithError)
 {
     $oParam = $oStructParam->structmem($fieldName);
     if (isset($oParam)) {
         if ($oParam->kindOf() != 'scalar') {
             return XmlRpcUtils::_getNonScalarValue($oStructure->{$fieldName}, $oParam, $oResponseWithError);
         } else {
             $oResponseWithError = XmlRpcUtils::generateError('Structure field \'' . $fieldName . '\' should be non-scalar type ');
             return false;
         }
     } else {
         return true;
     }
 }
 /**
  * This method sets targeting limitations for a channel.
  * It overrides existing limitations.
  *
  * @access public
  *
  * @param  XML_RPC_Message &$oParams
  *
  * @return generated result (boolean or error)
  */
 public function setChannelTargeting(&$oParams)
 {
     $oResponseWithError = null;
     $aTargeting = array();
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$channelId), array(true, true), $oParams, $oResponseWithError) || !XmlRpcUtils::getArrayOfStructuresScalarFields($aTargeting, 'OA_Dll_TargetingInfo', $oParams, 2, array('logical', 'type', 'comparison', 'data'), $oResponseWithError)) {
         return $oResponseWithError;
     }
     if ($this->_oChannelServiceImp->setChannelTargeting($sessionId, $channelId, $aTargeting)) {
         return XmlRpcUtils::booleanTypeResponse(true);
     } else {
         return XmlRpcUtils::generateError($this->_oChannelServiceImp->getLastError());
     }
 }
 /**
  * Gets conversion statistics for
  * a campaign for a specified period, or returns an error message.
  *
  * @param XML_RPC_Message &$oParams
  * @return generated result (data or error)
  */
 public function campaignConversionStatistics(&$oParams)
 {
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$campaignId, &$oStartDate, &$oEndDate, &$localTZ), array(true, true, false, false, false), $oParams, $oResponseWithError)) {
         return $oResponseWithError;
     }
     $rsStatisticsData = null;
     if ($this->_oCampaignServiceImp->getCampaignConversionStatistics($sessionId, $campaignId, $oStartDate, $oEndDate, $localTZ, $rsStatisticsData)) {
         return XmlRpcUtils::arrayOfStructuresResponse(array('campaignID' => 'integer', 'trackerID' => 'integer', 'bannerID' => 'integer', 'conversionTime' => 'date', 'conversionStatus' => 'integer', 'userIp' => 'string', 'action' => 'integer', 'window' => 'integer', 'variables' => 'struct'), $rsStatisticsData);
     } else {
         return XmlRpcUtils::generateError($this->_oCampaignServiceImp->getLastError());
     }
 }
 public function getTracker(&$oParams)
 {
     $sessionId = null;
     $trackerId = null;
     $oTrackerInfo = new OA_Dll_TrackerInfo();
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$trackerId), array(true, true), $oParams, $oResponseWithError)) {
         return $oResponseWithError;
     }
     if ($this->oTrackerServiceImpl->getTracker($sessionId, $trackerId, $oTrackerInfo)) {
         return XmlRpcUtils::getEntityResponse($oTrackerInfo);
     } else {
         return XmlRpcUtils::generateError($this->oTrackerServiceImpl->getLastError());
     }
 }
 function linkUserToManagerAccount($oParams)
 {
     $sessionId = null;
     $userId = null;
     $managerAccountId = null;
     $aPermissions = array();
     $oResponseWithError = null;
     if (!XmlRpcUtils::getScalarValues(array(&$sessionId, &$userId, &$managerAccountId), array(true, true, true), $oParams, $oResponseWithError) || !XmlRpcUtils::getNotRequiredNonScalarValue($aPermissions, $oParams, 3, $oResponseWithError)) {
         return $oResponseWithError;
     }
     if ($this->_oUserServiceImp->linkUserToManagerAccount($sessionId, $userId, $managerAccountId, $aPermissions)) {
         return XmlRpcUtils::booleanTypeResponse(true);
     } else {
         return XmlRpcUtils::generateError($this->_oUserServiceImp->getLastError());
     }
 }
function phpAds_Die($title = "Error", $message = "Unknown error")
{
    if (defined('OA_WEBSERVICES_API_XMLRPC')) {
        // It's an XML-RPC response
        if (class_exists('XmlRpcUtils')) {
            $oResponse = XmlRpcUtils::generateError($message);
        } else {
            $oResponse = new XML_RPC_Response('', 99999, $message);
        }
        echo $oResponse->serialize();
        exit;
    }
    $conf = $GLOBALS['_MAX']['CONF'];
    global $phpAds_GUIDone, $phpAds_TextDirection;
    $header = $title == $GLOBALS['strAccessDenied'] ? phpAds_Login : phpAds_Error;
    // Header
    if ($phpAds_GUIDone == false) {
        if (!isset($phpAds_TextDirection)) {
            $phpAds_TextDirection = 'ltr';
        }
        phpAds_PageHeader(phpAds_Error);
    }
    echo "<br>";
    echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/errormessage.gif' align='absmiddle'> ";
    echo "<span class='tab-r'>" . $title . "</span><br><br>" . $message . "</div><br>";
    // Die
    if ($header == phpAds_Login) {
        $_COOKIE['sessionID'] = phpAds_SessionStart();
        OA_Auth::displayLogin('', $_COOKIE['sessionID'], true);
    }
    phpAds_PageFooter();
    exit;
}