예제 #1
0
 /**
  * This method converts the Info object into an XML_RPC_Value and deletes null fields.
  *
  * @param object &$oInfoObject
  * @return XML_RPC_Value
  */
 function getEntityWithNotNullFields(&$oInfoObject)
 {
     $aInfoData = $oInfoObject->toArray();
     $aReturnData = array();
     foreach ($aInfoData as $fieldName => $fieldValue) {
         if (!is_null($fieldValue)) {
             $aReturnData[$fieldName] = XmlRpcUtils::_setRPCTypeForField($oInfoObject->getFieldType($fieldName), $fieldValue);
         }
     }
     return new XML_RPC_Value($aReturnData, $GLOBALS['XML_RPC_Struct']);
 }
 /**
  * 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());
     }
 }
 /**
  * This function sends a method call to a specified service.
  *
  * @param string $method  The name of the remote method to call.
  * @param mixed  $data    The data to send to the web service.
  * @return mixed The response from the server or false in the event of failure.
  */
 function _send($method, $data)
 {
     $dataMessage = array();
     foreach ($data as $element) {
         if (is_object($element) && is_subclass_of($element, 'OA_Info')) {
             $dataMessage[] = XmlRpcUtils::getEntityWithNotNullFields($element);
         } else {
             $dataMessage[] = XML_RPC_encode($element);
         }
     }
     $message = new XML_RPC_Message($method, $dataMessage);
     $client =& $this->_getClient();
     // Send the XML-RPC message to the server.
     $response = $client->send($message, $this->timeout, $this->ssl ? 'https' : 'http');
     // Check for an error response.
     if ($response && $response->faultCode() == 0) {
         $result = XML_RPC_decode($response->value());
     } else {
         trigger_error('XML-RPC Error (' . $response->faultCode() . '): ' . $response->faultString() . ' in method ' . $method . '()', E_USER_ERROR);
     }
     return $result;
 }
 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());
     }
 }
예제 #8
0
 /**
  * Gets Structure Scalar and non-Scalar fields
  *
  * @access public
  *
  * @param structure &$oStructure  to return data
  * @param XML_RPC_Message &$oParams
  * @param integer $idxParam
  * @param array $aScalars Field names array
  * @param array $aNonScalars Field names array
  * @param XML_RPC_Response &$oResponseWithError
  *
  * @return boolean  shows true if method was executed successfully
  */
 function getStructureScalarAndNotScalarFields(&$oStructure, &$oParams, $idxParam, $aScalars, $aNonScalars, &$oResponseWithError)
 {
     $result = XmlRpcUtils::getStructureScalarFields($oStructure, $oParams, $idxParam, $aScalars, $oResponseWithError);
     if ($result) {
         $oStructParam = $oParams->getParam($idxParam);
         foreach ($aNonScalars as $fieldName) {
             if (!XmlRpcUtils::_getStructureNonScalarField($oStructure, $oStructParam, $fieldName, $oResponseWithError)) {
                 return false;
             }
         }
     } else {
         return false;
     }
     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());
     }
 }
예제 #13
0
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;
}