示例#1
0
/**
 * DeserializationFilter has the job of taking the raw input stream and converting in into valid php objects.
 * 
 * The DeserializationFilter is just part of a set of Filter chains used to manipulate the raw data.  Here we
 * get the input stream and convert it to php objects using the helper class AMFInputStream.
 */
function deserializationFilter(&$amf)
{
    if ($GLOBALS['amfphp']['native'] === true && function_exists('amf_decode')) {
        include_once AMFPHP_BASE . "amf/io/AMFBaseDeserializer.php";
        include_once AMFPHP_BASE . "amf/io/AMFBaseSerializer.php";
        $deserializer = new AMFBaseDeserializer($amf->rawData);
        // deserialize the data
    } else {
        include_once AMFPHP_BASE . "amf/io/AMFDeserializer.php";
        include_once AMFPHP_BASE . "amf/io/AMFSerializer.php";
        $deserializer = new AMFDeserializer($amf->rawData);
        // deserialize the data
    }
    $deserializer->deserialize($amf);
    // run the deserializer
    //Add some headers
    $headers = $amf->_headerTable;
    if (isset($headers) && is_array($headers)) {
        foreach ($headers as $key => $value) {
            Headers::setHeader($value->name, $value->value);
        }
    }
    //Set as a describe service
    $describeHeader = $amf->getHeader(AMFPHP_SERVICE_BROWSER_HEADER);
    if ($describeHeader !== false) {
        if ($GLOBALS['amfphp']['disableDescribeService']) {
            //Exit
            trigger_error("Service description not allowed", E_USER_ERROR);
            die;
        }
        $bodyCopy =& $amf->getBodyAt(0);
        $bodyCopy->setSpecialHandling('describeService');
        $bodyCopy->noExec = true;
    }
}
示例#2
0
 function getHeader($key)
 {
     return Headers::setHeader($key);
 }