1
+ <?php
2
+ require_once "Auth/OpenID/Discover.php " ;
3
+ require_once "Auth/Yadis/Yadis.php " ;
4
+
5
+ function getOpenIDIdentifier ()
6
+ {
7
+ return $ _GET ['openid_identifier ' ];
8
+ }
9
+
10
+ function escape ($ x )
11
+ {
12
+ return htmlentities ($ x );
13
+ }
14
+
15
+
16
+ $ identifier = getOpenIDIdentifier ();
17
+ ?>
18
+ <html>
19
+ <head>
20
+ <title>OpenID discovery</title>
21
+ </head>
22
+ <body>
23
+ <h2>OpenID discovery tool</h2>
24
+ <p>
25
+ Enter an OpenID URL to begin discovery:
26
+ </p>
27
+ <form>
28
+ <input type="text" name="openid_identifier" size="40" />
29
+ <input type="submit" value="Begin" />
30
+ </form>
31
+ <?
32
+ if ($ identifier ) {
33
+
34
+ $ fetcher = Auth_Yadis_Yadis::getHTTPFetcher ();
35
+ list ($ normalized_identifier , $ endpoints ) = Auth_OpenID_discover (
36
+ $ identifier , $ fetcher );
37
+
38
+ ?>
39
+ <h3>Discovery Results for <?= escape ($ identifier ) ?> </h3>
40
+
41
+ <table cellpadding="7" cellspacing="0">
42
+ <tbody>
43
+ <tr>
44
+ <th>Claimed Identifier</th>
45
+ <td><?= escape ($ normalized_identifier ) ?> </td>
46
+ </tr>
47
+ <?
48
+ if (!$ endpoints ) {
49
+ ?>
50
+ <tr>
51
+ <td colspan="2">No OpenID services discovered.</td>
52
+ </tr>
53
+ <?
54
+ } else {
55
+ ?>
56
+ <tr>
57
+ <td colspan="2">Discovered OpenID services:</td>
58
+ </tr>
59
+ <?
60
+ foreach ($ endpoints as $ endpoint ) {
61
+ ?>
62
+ <tr>
63
+ <td colspan="2"><hr/></td>
64
+ </tr>
65
+ <tr>
66
+ <th>Server URL</th>
67
+ <td><tt><?= escape ($ endpoint ->server_url ) ?> </tt></td>
68
+ </tr>
69
+ <tr>
70
+ <th>Local ID</th>
71
+ <td><tt><?= escape ($ endpoint ->local_id ) ?> </tt></td>
72
+ </tr>
73
+ <tr>
74
+ <td colspan="2">
75
+ <h3>Service types:</h3>
76
+ <ul>
77
+ <?
78
+ foreach ($ endpoint ->type_uris as $ type_uri ) {
79
+ ?>
80
+ <li><tt><?= escape ($ type_uri ) ?> </tt></li>
81
+ <?
82
+ }
83
+ ?>
84
+ </ul>
85
+ </td>
86
+ </tr>
87
+ <?
88
+ }
89
+ }
90
+ ?>
91
+ </tbody>
92
+ </table>
93
+ <?
94
+ }
95
+ ?>
96
+ </body>
97
+ </html>
0 commit comments