Example #1
0
function exitWithInternalError( $errorText )
{
    header( $_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error' );
    //include_once( 'extension/ezjscore/classes/ezjscajaxcontent.php' );
    $contentType = ezjscAjaxContent::getHttpAccept();

    // set headers
    if ( $contentType === 'xml' )
        header('Content-Type: text/xml; charset=utf-8');
    else if ( $contentType === 'json' )
        header('Content-Type: text/javascript; charset=utf-8');

    echo ezjscAjaxContent::autoEncode( array( 'error_text' => $errorText, 'content' => '' ), $contentType );
    eZExecution::cleanExit();
}
Example #2
0
    $streamSeperator = '@END$';
}
if ($http->hasPostVariable('ezjscServer_function_arguments')) {
    $callList = explode($callSeperator, strip_tags($http->postVariable('ezjscServer_function_arguments')));
} else {
    if (isset($Params['function_arguments'])) {
        $callList = explode($callSeperator, strip_tags($Params['function_arguments']));
    } else {
        $callList = array();
    }
}
// Allow get parameter to be set to test in browser
if (isset($_GET['ContentType'])) {
    $contentType = $_GET['ContentType'];
} else {
    $contentType = ezjscAjaxContent::getHttpAccept();
    header('Vary: Accept');
}
// set http headers
if ($contentType === 'xml') {
    header('Content-Type: text/xml; charset=utf-8');
} else {
    if ($contentType === 'javascript') {
        $contentType = 'json';
        header('Content-Type: text/javascript; charset=utf-8');
    } else {
        if ($contentType === 'json') {
            header('Content-Type: application/json; charset=utf-8');
        }
    }
}