about.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. require_once "lib/session.php";
  3. require_once "lib/render.php";
  4. define('about_error_template',
  5. '<div class="error">
  6. An error occurred when processing your request:
  7. <br />
  8. %s
  9. </div>');
  10. define('about_body',
  11. '<p>
  12. This is an <a href="http://www.openid.net/">OpenID</a> server
  13. endpoint. This server is built on the <a
  14. href="http://github.com/openid/php-openid">JanRain PHP OpenID
  15. library</a>. Since OpenID consumer sites will need to directly contact this
  16. server, it must be accessible over the Internet (not behind a firewall).
  17. </p>
  18. <p>
  19. To use this server, you will have to set up a URL to use as an identifier.
  20. Insert the following markup into the <code>&lt;head&gt;</code> of the HTML
  21. document at that URL:
  22. </p>
  23. <pre>&lt;link rel="openid.server" href="%s" /&gt;</pre>
  24. <p>
  25. Then configure this server so that you can log in with that URL.
  26. </p>
  27. ');
  28. /**
  29. * Render the about page, potentially with an error message
  30. */
  31. function about_render($error=false, $internal=true)
  32. {
  33. $headers = array();
  34. $body = sprintf(about_body, buildURL());
  35. if ($error) {
  36. $headers[] = $internal ? http_internal_error : http_bad_request;
  37. $body .= sprintf(about_error_template, htmlspecialchars($error));
  38. }
  39. $current_user = getLoggedInUser();
  40. return page_render($body, $current_user, 'OpenID Server Endpoint');
  41. }
  42. ?>