Ejemplo n.º 1
0
}
if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/serve') {
    require_once "render.php";
    render_serve($method, $request, $template);
    exit(0);
    // If it's a request for an identity URL, render that.
} else {
    if (array_key_exists('user', $request) && $request['user']) {
        require_once "render.php";
        render_identityPage($method, $request, $template);
        exit(0);
        // If it's a request for a user's XRDS, render that.
    } else {
        if (array_key_exists('xrds', $request) && $request['xrds']) {
            require_once "render.php";
            render_XRDS($method, $request, $template);
            exit(0);
        }
    }
}
// If any messages are pending, get them and display them.
$messages = Server_getMessages();
foreach ($messages as $m) {
    $template->addMessage($m);
}
Server_clearMessages();
if ($request === null) {
    // Error; $method not supported.
    $template->addError("Request method {$method} not supported.");
    $template->display();
} else {
Ejemplo n.º 2
0
function render_identityPage($method, &$request, &$template)
{
    $serve_xrds_now = false;
    // If an Accept header is sent, display the XRDS immediately;
    // otherwise, display the identity page with an XRDS location
    // header.
    $headers = apache_request_headers();
    foreach ($headers as $header => $value) {
        if ($header == 'Accept' && preg_match("/application\\/xrds\\+xml/", $value)) {
            $serve_xrds_now = true;
        }
    }
    if ($serve_xrds_now) {
        $request['xrds'] = $request['user'];
        render_XRDS($method, $request, $template);
    } else {
        header("X-XRDS-Location: " . getServerURL() . "?xrds=" . $request['user']);
        $template->assign('openid_url', Server_getAccountIdentifier($request['user']));
        $template->assign('user', $request['user']);
        $template->display('idpage.tpl', true);
    }
}