show() public method

This method displays a standard SimpleSAMLphp error page and exits.
public show ( )
示例#1
0
function SimpleSAML_exception_handler(Exception $exception)
{
    if ($exception instanceof SimpleSAML_Error_Error) {
        $exception->show();
    } else {
        $e = new SimpleSAML_Error_Error('UNHANDLEDEXCEPTION', $exception);
        $e->show();
    }
}
示例#2
0
function SimpleSAML_exception_handler($exception)
{
    SimpleSAML\Module::callHooks('exception_handler', $exception);
    if ($exception instanceof SimpleSAML_Error_Error) {
        $exception->show();
    } elseif ($exception instanceof Exception) {
        $e = new SimpleSAML_Error_Error('UNHANDLEDEXCEPTION', $exception);
        $e->show();
    } else {
        if (class_exists('Error') && $exception instanceof Error) {
            $code = $exception->getCode();
            $errno = $code > 0 ? $code : E_ERROR;
            $errstr = $exception->getMessage();
            $errfile = $exception->getFile();
            $errline = $exception->getLine();
            SimpleSAML_error_handler($errno, $errstr, $errfile, $errline);
        }
    }
}
示例#3
0
        if (array_key_exists($type, $mimeTypes)) {
            $contentType = $mimeTypes[$type];
        }
    }
    if ($contentType === null) {
        /* We were unable to determine the MIME type from the file extension. Fall back to mime_content_type (if it
         * exists).
         */
        if (function_exists('mime_content_type')) {
            $contentType = mime_content_type($path);
        } else {
            // mime_content_type doesn't exist. Return a default MIME type
            SimpleSAML_Logger::warning('Unable to determine mime content type of file: ' . $path);
            $contentType = 'application/octet-stream';
        }
    }
    $contentLength = sprintf('%u', filesize($path));
    // force filesize to an unsigned number
    header('Content-Type: ' . $contentType);
    header('Content-Length: ' . $contentLength);
    header('Cache-Control: public,max-age=86400');
    header('Expires: ' . gmdate('D, j M Y H:i:s \\G\\M\\T', time() + 10 * 60));
    header('Last-Modified: ' . gmdate('D, j M Y H:i:s \\G\\M\\T', filemtime($path)));
    readfile($path);
    exit;
} catch (SimpleSAML_Error_Error $e) {
    $e->show();
} catch (Exception $e) {
    $e = new SimpleSAML_Error_Error('UNHANDLEDEXCEPTION', $e);
    $e->show();
}
示例#4
0
function SimpleSAML_exception_handler(Exception $exception)
{
    $e = new SimpleSAML_Error_Error('UNHANDLEDEXCEPTION', $exception);
    $e->show();
}