trust.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. require_once "lib/session.php";
  3. require_once "lib/render.php";
  4. define('trust_form_pat',
  5. '<div class="form">
  6. <form method="post" action="%s">
  7. %s
  8. <input type="submit" name="trust" value="Confirm" />
  9. <input type="submit" value="Do not confirm" />
  10. </form>
  11. </div>
  12. ');
  13. define('normal_pat',
  14. '<p>Do you wish to confirm your identity ' .
  15. '(<code>%s</code>) with <code>%s</code>?</p>');
  16. define('id_select_pat',
  17. '<p>You entered the server URL at the RP.
  18. Please choose the name you wish to use. If you enter nothing, the request will be cancelled.<br/>
  19. <input type="text" name="idSelect" /></p>
  20. ');
  21. define('no_id_pat',
  22. '
  23. You did not send an identifier with the request,
  24. and it was not an identifier selection request.
  25. Please return to the relying party and try again.
  26. ');
  27. function trust_render($info)
  28. {
  29. $current_user = getLoggedInUser();
  30. $lnk = link_render(idURL($current_user));
  31. $trust_root = htmlspecialchars($info->trust_root);
  32. $trust_url = buildURL('trust', true);
  33. if ($info->idSelect()) {
  34. $prompt = id_select_pat;
  35. } else {
  36. $prompt = sprintf(normal_pat, $lnk, $trust_root);
  37. }
  38. $form = sprintf(trust_form_pat, $trust_url, $prompt);
  39. return page_render($form, $current_user, 'Trust This Site');
  40. }
  41. function noIdentifier_render()
  42. {
  43. return page_render(no_id_pat, null, 'No Identifier Sent');
  44. }
  45. ?>