Exemple #1
0
function serializationAction(&$body)
{
    //Take the raw response
    $rawResponse =& $body->getResults();
    error_log("[SWX] INFO Method call result = {$rawResponse}");
    adapterMap($rawResponse);
    $swxAssembler = null;
    $defaultFormat = 'as2';
    if (isset($_POST['format'])) {
        $defaultFormat = $_POST['format'];
    } elseif (isset($_GET['format'])) {
        $defaultFormat = $_GET['format'];
    }
    error_log('encoding with ' . $defaultFormat);
    if ($defaultFormat == 'as3') {
        require_once SWX_BASE . 'SwxAssembler3.php';
        $swxAssembler = new SwxAssembler3();
    } else {
        require_once SWX_BASE . 'SwxAssembler.php';
        $swxAssembler = new SwxAssembler();
    }
    ob_start();
    $swxAssembler->writeSwf($rawResponse, $GLOBALS['swx']['debug'], 4, $GLOBALS['swx']['url']);
    $rawResponse = ob_get_contents();
    ob_end_clean();
    $body->setResults($rawResponse);
}
Exemple #2
0
function errorHandler($errorNum, $errorStr, $errorFile, $errorLine)
{
    $errorMsg = "Error {$errorNum}: {$errorStr} in {$errorFile}, line {$errorLine}.";
    $GLOBALS['swxLastErrorMessage'] = $errorMsg;
    // Display the error message in the PHP error log
    error_log($errorMsg);
    if ($errorNum != E_STRICT && $errorNum != E_NOTICE) {
        // On errors and warnings, stop execution and return the
        // error message to the client. This is a far better
        // alternative to failing silently.
        error_log($errorMsg);
        $swxAssembler = new SwxAssembler();
        $swxAssembler->writeSwf($errorMsg, !empty($GLOBALS['swx']['debug']) ? $GLOBALS['swx']['debug'] : false);
        exit;
    }
}
Exemple #3
0
 function VerboseException($string, $level, $file, $line)
 {
     $this->description = $string;
     $this->level = $level;
     $this->code = "AMFPHP_RUNTIME_ERROR";
     $this->file = $file;
     $this->line = $line;
     Exception::__construct($string);
     $errorMsg = "Error {$level}: {$string} in {$file}, line {$line}.";
     $GLOBALS['swxLastErrorMessage'] = $errorMsg;
     // Display the error message in the PHP error log
     error_log($errorMsg);
     if ($level != E_STRICT && $level != E_NOTICE) {
         // On errors and warnings, stop execution and return the
         // error message to the client. This is a far better
         // alternative to failing silently.
         error_log($errorMsg);
         $swxAssembler = new SwxAssembler();
         $swxAssembler->writeSwf($errorMsg, !empty($GLOBALS['swx']['debug']) ? $GLOBALS['swx']['debug'] : false);
         exit;
     }
 }
Exemple #4
0
error_reporting(E_ALL);
// Load the configuration info
include 'swx_config.php';
// Load and instantiate the SWX Assembler
$defaultFormat = 'as2';
if (isset($_POST['format'])) {
    $defaultFormat = $_POST['format'];
} elseif (isset($_GET['format'])) {
    $defaultFormat = $_GET['format'];
}
if ($defaultFormat == 'as3') {
    include 'SwxAssembler3.php';
    $swxAssembler = new SwxAssembler3();
} else {
    include 'SwxAssembler.php';
    $swxAssembler = new SwxAssembler();
}
// Global configuration information
global $swx;
$swx = array();
// Change to the service folder from here on.
// This works exactly like Amfphp to make sure that Amfphp and SWX
// services are compatible.
chdir($servicesPath);
/**
 * Returns a SWX with the passed error message in the result object.
 *
 * @param	(str) The error message to return to the client.
 * 
 * @return void (exits)
 * @author Aral Balkan