/** * A function to handle XML-RPC advertisement view requests. 2.0 version * * @deprecated * * @param XML_RPC_Message $params * @return XML_RPC_Response */ function OA_Delivery_XmlRpc_View_PAN($params) { // Extract the remote_info parameter $remoteInfoXmlRpcValue = $params->getParam(0); $remote_info = XML_RPC_Decode($params->getParam(0)); // Add empty cookies array $remote_info['cookies'] = array(); // Create environment array $remoteInfoXmlRpcValue = XML_RPC_encode($remote_info); // Extract the context param if ($params->getNumParams() > 6) { $contextXmlRpcValue = $params->getParam(6); } else { $contextXmlRpcValue = new XML_RPC_Value(array(), $XML_RPC_Array); } // Recreate XML-RPC message $msg = new XML_RPC_Message('phpAds.view', array($remoteInfoXmlRpcValue, $params->getParam(1), $params->getParam(2), $params->getParam(3), $params->getParam(4), $params->getParam(5), $contextXmlRpcValue)); // Relay call to openads.view $xmlResponse = OA_Delivery_XmlRpc_View($msg); // Check for errors as-is return $xmlResponse; }
/** * @param XML_RPC_Message $in * @param array $sig * @return array */ function verifySignature($in, array $sig) { for ($i = 0; $i < count($sig); $i++) { // check each possible signature in turn $currentSig = $sig[$i]; if (count($currentSig) == $in->getNumParams() + 1) { $itsOK = 1; for ($n = 0; $n < $in->getNumParams(); $n++) { $p = $in->getParam($n); // print "<!-- $p -->\n"; if ($p->kindOf() === 'scalar') { $pt = $p->scalartyp(); } else { $pt = $p->kindOf(); } // $n+1 as first type of sig is return type if ($pt != $currentSig[$n + 1]) { $itsOK = 0; $pno = $n + 1; $wanted = $currentSig[$n + 1]; $got = $pt; break; } } if ($itsOK) { return array(1); } } } if (isset($wanted)) { return array(0, "Wanted {$wanted}, got {$got} at param {$pno}"); } else { $allowed = array(); foreach ($sig as $val) { end($val); $allowed[] = key($val); } $allowed = array_unique($allowed); $last = count($allowed) - 1; if ($last > 0) { $allowed[$last] = 'or ' . $allowed[$last]; } return array(0, 'Signature permits ' . implode(', ', $allowed) . ' parameters but the request had ' . $in->getNumParams()); } }