Index: trunk/extensions/OpenID/SpecialOpenID.body.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * SpecialOpenID.body.php -- Superclass for all |
| 4 | + * SpecialOpenID.body.php -- Superclass for all |
5 | 5 | * Copyright 2006,2007 Internet Brands (http://www.internetbrands.com/) |
6 | 6 | * Copyright 2008 by Evan Prodromou (http://evan.prodromou.name/) |
7 | 7 | * |
— | — | @@ -30,15 +30,15 @@ |
31 | 31 | require_once("Auth/OpenID/FileStore.php"); |
32 | 32 | |
33 | 33 | class SpecialOpenID extends SpecialPage { |
34 | | - |
| 34 | + |
35 | 35 | function getOpenIDStore($storeType, $prefix, $options) { |
36 | 36 | global $wgOut; |
37 | 37 | |
38 | 38 | # FIXME: support other kinds of store |
39 | 39 | # XXX: used to support memc, now use memcached from php-openid |
40 | | - |
| 40 | + |
41 | 41 | switch ($storeType) { |
42 | | - |
| 42 | + |
43 | 43 | case 'file': |
44 | 44 | # Auto-create path if it doesn't exist |
45 | 45 | if (!is_dir($options['path'])) { |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $wgOut->showErrorPage('openidconfigerror', 'openidconfigerrortext'); |
55 | 55 | } |
56 | 56 | } |
57 | | - |
| 57 | + |
58 | 58 | function xriBase($xri) { |
59 | 59 | if (substr($xri, 0, 6) == 'xri://') { |
60 | 60 | return substr($xri, 6); |
— | — | @@ -61,11 +61,11 @@ |
62 | 62 | return $xri; |
63 | 63 | } |
64 | 64 | } |
65 | | - |
| 65 | + |
66 | 66 | function xriToUrl($xri) { |
67 | 67 | return 'http://xri.net/' . OpenIDXriBase($xri); |
68 | 68 | } |
69 | | - |
| 69 | + |
70 | 70 | function OpenIDToUrl($openid) { |
71 | 71 | /* ID is either an URL already or an i-name */ |
72 | 72 | if (Auth_Yadis_identifierScheme($openid) == 'XRI') { |
— | — | @@ -74,36 +74,20 @@ |
75 | 75 | return $openid; |
76 | 76 | } |
77 | 77 | } |
78 | | - |
| 78 | + |
79 | 79 | function LocalizedPageName(&$specialPageArray, $code) { |
80 | | - |
| 80 | + |
81 | 81 | # The localized title of the special page is among the messages of the extension: |
82 | | - SpecialOpenID::loadMessages(); |
| 82 | + wfLoadExtensionMessages( 'OpenID' ); |
83 | 83 | $text = wfMsg('openidlogin'); |
84 | | - |
| 84 | + |
85 | 85 | # Convert from title in text form to DBKey and put it into the alias array: |
86 | 86 | $title = Title::newFromText($text); |
87 | 87 | $specialPageArray['Form'][] = $title->getDBKey(); |
88 | | - |
| 88 | + |
89 | 89 | return true; |
90 | 90 | } |
91 | | - |
92 | | - function loadMessages() { |
93 | | - static $messagesLoaded = false; |
94 | | - global $wgMessageCache; |
95 | | - |
96 | | - if ( $messagesLoaded ) return true; |
97 | | - |
98 | | - require( dirname( __FILE__ ) . '/OpenID.i18n.php' ); |
99 | | - foreach ( $OpenIDMessages as $lang => $langMessages ) { |
100 | | - $wgMessageCache->addMessages( $langMessages, $lang ); |
101 | | - } |
102 | | - |
103 | | - $messagesLoaded = true; |
104 | | - |
105 | | - return true; |
106 | | - } |
107 | | - |
| 91 | + |
108 | 92 | function interwikiExpand($openid_url) { |
109 | 93 | # try to make it into a title object |
110 | 94 | $nt = Title::newFromText($openid_url); |
— | — | @@ -115,10 +99,10 @@ |
116 | 100 | return $openid_url; |
117 | 101 | } |
118 | 102 | } |
119 | | - |
| 103 | + |
120 | 104 | function getUserUrl($user) { |
121 | 105 | $openid_url = null; |
122 | | - |
| 106 | + |
123 | 107 | if (isset($user) && $user->getId() != 0) { |
124 | 108 | global $wgSharedDB, $wgDBprefix; |
125 | 109 | if (isset($wgSharedDB)) { |
— | — | @@ -126,16 +110,16 @@ |
127 | 111 | } else { |
128 | 112 | $tableName = 'user_openid'; |
129 | 113 | } |
130 | | - |
| 114 | + |
131 | 115 | $dbr =& wfGetDB( DB_SLAVE ); |
132 | 116 | $res = $dbr->select(array($tableName), |
133 | 117 | array('uoi_openid'), |
134 | 118 | array('uoi_user' => $user->getId()), |
135 | 119 | 'OpenIDGetUserUrl'); |
136 | | - |
| 120 | + |
137 | 121 | # This should return 0 or 1 result, since user is unique |
138 | 122 | # in the table. |
139 | | - |
| 123 | + |
140 | 124 | while ($res && $row = $dbr->fetchObject($res)) { |
141 | 125 | $openid_url = $row->uoi_openid; |
142 | 126 | } |
— | — | @@ -143,19 +127,19 @@ |
144 | 128 | } |
145 | 129 | return $openid_url; |
146 | 130 | } |
147 | | - |
| 131 | + |
148 | 132 | # Login, Finish |
149 | | - |
| 133 | + |
150 | 134 | function getConsumer() { |
151 | 135 | global $wgOpenIDConsumerStoreType, $wgOpenIDConsumerStorePath; |
152 | | - |
| 136 | + |
153 | 137 | $store = $this->getOpenIDStore($wgOpenIDConsumerStoreType, |
154 | 138 | 'consumer', |
155 | 139 | array('path' => $wgOpenIDConsumerStorePath)); |
156 | | - |
| 140 | + |
157 | 141 | return new Auth_OpenID_Consumer($store); |
158 | 142 | } |
159 | | - |
| 143 | + |
160 | 144 | function fullUrl($title) { |
161 | 145 | $nt = Title::makeTitleSafe(NS_SPECIAL, $title); |
162 | 146 | if (isset($nt)) { |
— | — | @@ -164,7 +148,7 @@ |
165 | 149 | return NULL; |
166 | 150 | } |
167 | 151 | } |
168 | | - |
| 152 | + |
169 | 153 | function scriptUrl($title) { |
170 | 154 | global $wgServer, $wgScript; |
171 | 155 | $nt = Title::makeTitleSafe(NS_SPECIAL, $title); |
— | — | @@ -175,15 +159,15 @@ |
176 | 160 | return $url; |
177 | 161 | } |
178 | 162 | } |
179 | | - |
| 163 | + |
180 | 164 | function canLogin($openid_url) { |
181 | | - |
| 165 | + |
182 | 166 | global $wgOpenIDConsumerDenyByDefault, $wgOpenIDConsumerAllow, $wgOpenIDConsumerDeny; |
183 | | - |
| 167 | + |
184 | 168 | if ($this->isLocalUrl($openid_url)) { |
185 | 169 | return false; |
186 | 170 | } |
187 | | - |
| 171 | + |
188 | 172 | if ($wgOpenIDConsumerDenyByDefault) { |
189 | 173 | $canLogin = false; |
190 | 174 | foreach ($wgOpenIDConsumerAllow as $allow) { |
— | — | @@ -219,29 +203,29 @@ |
220 | 204 | } |
221 | 205 | return $canLogin; |
222 | 206 | } |
223 | | - |
| 207 | + |
224 | 208 | function isLocalUrl($url) { |
225 | | - |
| 209 | + |
226 | 210 | global $wgServer, $wgArticlePath; |
227 | | - |
| 211 | + |
228 | 212 | $pattern = $wgServer . $wgArticlePath; |
229 | 213 | $pattern = str_replace('$1', '(.*)', $pattern); |
230 | 214 | $pattern = str_replace('?', '\?', $pattern); |
231 | | - |
| 215 | + |
232 | 216 | return preg_match('|^' . $pattern . '$|', $url); |
233 | 217 | } |
234 | | - |
| 218 | + |
235 | 219 | # Find the user with the given openid, if any |
236 | | - |
| 220 | + |
237 | 221 | function getUser($openid) { |
238 | 222 | global $wgSharedDB, $wgDBprefix; |
239 | | - |
| 223 | + |
240 | 224 | if (isset($wgSharedDB)) { |
241 | 225 | $tableName = "`$wgSharedDB`.${wgDBprefix}user_openid"; |
242 | 226 | } else { |
243 | 227 | $tableName = 'user_openid'; |
244 | 228 | } |
245 | | - |
| 229 | + |
246 | 230 | $dbr =& wfGetDB( DB_SLAVE ); |
247 | 231 | $id = $dbr->selectField($tableName, 'uoi_user', |
248 | 232 | array('uoi_openid' => $openid)); |
— | — | @@ -253,22 +237,22 @@ |
254 | 238 | } |
255 | 239 | } |
256 | 240 | function login($openid_url, $finish_page = 'OpenIDFinish') { |
257 | | - |
| 241 | + |
258 | 242 | global $wgUser, $wgTrustRoot, $wgOut; |
259 | | - |
| 243 | + |
260 | 244 | # If it's an interwiki link, expand it |
261 | | - |
| 245 | + |
262 | 246 | $openid_url = $this->interwikiExpand($openid_url); |
263 | | - |
| 247 | + |
264 | 248 | # Check if the URL is allowed |
265 | | - |
| 249 | + |
266 | 250 | if (!$this->canLogin($openid_url)) { |
267 | 251 | $wgOut->showErrorPage('openidpermission', 'openidpermissiontext'); |
268 | 252 | return; |
269 | 253 | } |
270 | | - |
| 254 | + |
271 | 255 | $sk = $wgUser->getSkin(); |
272 | | - |
| 256 | + |
273 | 257 | if (isset($wgTrustRoot)) { |
274 | 258 | $trust_root = $wgTrustRoot; |
275 | 259 | } else { |
— | — | @@ -276,61 +260,61 @@ |
277 | 261 | $root_article = str_replace('$1', '', $wgArticlePath); |
278 | 262 | $trust_root = $wgServer . $root_article; |
279 | 263 | } |
280 | | - |
| 264 | + |
281 | 265 | $consumer = $this->getConsumer(); |
282 | | - |
| 266 | + |
283 | 267 | if (!$consumer) { |
284 | 268 | $wgOut->showErrorPage('openiderror', 'openiderrortext'); |
285 | 269 | return; |
286 | 270 | } |
287 | | - |
| 271 | + |
288 | 272 | # Make sure the user has a session! |
289 | | - |
| 273 | + |
290 | 274 | global $wgSessionStarted; |
291 | | - |
| 275 | + |
292 | 276 | if (!$wgSessionStarted) { |
293 | 277 | $wgUser->SetupSession(); |
294 | 278 | } |
295 | | - |
| 279 | + |
296 | 280 | $auth_request = $consumer->begin($openid_url); |
297 | | - |
| 281 | + |
298 | 282 | // Handle failure status return values. |
299 | 283 | if (!$auth_request) { |
300 | 284 | $wgOut->showErrorPage('openiderror', 'openiderrortext'); |
301 | 285 | return; |
302 | 286 | } |
303 | | - |
| 287 | + |
304 | 288 | # Check the processed URLs, too |
305 | | - |
| 289 | + |
306 | 290 | $endpoint = $auth_request->endpoint; |
307 | | - |
| 291 | + |
308 | 292 | if (isset($endpoint)) { |
309 | 293 | # Check if the URL is allowed |
310 | | - |
| 294 | + |
311 | 295 | if (isset($endpoint->identity_url) && !$this->canLogin($endpoint->identity_url)) { |
312 | 296 | $wgOut->showErrorPage('openidpermission', 'openidpermissiontext'); |
313 | 297 | return; |
314 | 298 | } |
315 | | - |
| 299 | + |
316 | 300 | if (isset($endpoint->delegate) && !$this->canLogin($endpoint->delegate)) { |
317 | 301 | $wgOut->showErrorPage('openidpermission', 'openidpermissiontext'); |
318 | 302 | return; |
319 | 303 | } |
320 | 304 | } |
321 | | - |
| 305 | + |
322 | 306 | $sreg_request = Auth_OpenID_SRegRequest::build( |
323 | 307 | // Required |
324 | 308 | array(), |
325 | 309 | // Optional |
326 | 310 | array('nickname','email', |
327 | 311 | 'fullname','language','timezone')); |
328 | | - |
| 312 | + |
329 | 313 | if ($sreg_request) { |
330 | 314 | $auth_request->addExtension($sreg_request); |
331 | 315 | } |
332 | | - |
| 316 | + |
333 | 317 | $process_url = $this->scriptUrl($finish_page); |
334 | | - |
| 318 | + |
335 | 319 | if ($auth_request->shouldSendRedirect()) { |
336 | 320 | $redirect_url = $auth_request->redirectURL($trust_root, |
337 | 321 | $process_url); |
— | — | @@ -345,7 +329,7 @@ |
346 | 330 | $form_id = 'openid_message'; |
347 | 331 | $form_html = $auth_request->formMarkup($trust_root, $process_url, |
348 | 332 | false, array('id' => $form_id)); |
349 | | - |
| 333 | + |
350 | 334 | // Display an error if the form markup couldn't be generated; |
351 | 335 | // otherwise, render the HTML. |
352 | 336 | if (Auth_OpenID::isFailure($form_html)) { |
Property changes on: trunk/extensions/OpenID/SpecialOpenID.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
353 | 337 | + native |
Index: trunk/extensions/OpenID/OpenID.i18n.php |
— | — | @@ -22,82 +22,71 @@ |
23 | 23 | * @addtogroup Extensions |
24 | 24 | */ |
25 | 25 | |
26 | | -if (!defined('MEDIAWIKI')) { |
27 | | - exit( 1 ); |
28 | | -} |
| 26 | +$messages = array(); |
29 | 27 | |
30 | | -$OpenIDMessages =array( |
31 | | - 'en' => array('openidlogin' => 'Login with OpenID', |
32 | | - 'openidfinish' => 'Finish OpenID login', |
33 | | - 'openidserver' => 'OpenID server', |
34 | | - 'openidconvert' => 'OpenID converter', |
35 | | - 'openiderror' => 'Verification error', |
36 | | - 'openiderrortext' => 'An error occured during verification of the OpenID URL.', |
37 | | - 'openidconfigerror' => 'OpenID Configuration Error', |
38 | | - 'openidconfigerrortext' => 'The OpenID storage configuration for this wiki is invalid. Please consult this site\'s administrator.', |
39 | | - 'openidpermission' => 'OpenID permissions error', |
40 | | - 'openidpermissiontext' => 'The OpenID you provided is not allowed to login to this server.', |
41 | | - 'openidcancel' => 'Verification cancelled', |
42 | | - 'openidcanceltext' => 'Verification of the OpenID URL was cancelled.', |
43 | | - 'openidfailure' => 'Verification failed', |
44 | | - 'openidfailuretext' => 'Verification of the OpenID URL failed. Error message: "$1"', |
45 | | - 'openidsuccess' => 'Verification succeeded', |
46 | | - 'openidsuccesstext' => 'Verification of the OpenID URL succeeded.', |
47 | | - 'openidusernameprefix' => 'OpenIDUser', |
48 | | - 'openidserverlogininstructions' => 'Enter your password below to log in to $3 as user $2 (user page $1).', |
49 | | - 'openidtrustinstructions' => 'Check if you want to share data with $1.', |
50 | | - 'openidallowtrust' => 'Allow $1 to trust this user account.', |
51 | | - 'openidnopolicy' => 'Site has not specified a privacy policy.', |
52 | | - 'openidpolicy' => 'Check the <a target="_new" href="$1">privacy policy</a> for more information.', |
53 | | - 'openidoptional' => 'Optional', |
54 | | - 'openidrequired' => 'Required', |
55 | | - 'openidnickname' => 'Nickname', |
56 | | - 'openidfullname' => 'Fullname', |
57 | | - 'openidemail' => 'Email address', |
58 | | - 'openidlanguage' => 'Language', |
59 | | - 'openidnotavailable' => 'Your preferred nickname ($1) is already in use by another user.', |
60 | | - 'openidnotprovided' => 'Your OpenID server did not provide a nickname (either because it can\'t, or because you told it not to).', |
61 | | - 'openidchooseinstructions' => 'All users need a nickname; you can choose one from the options below.', |
62 | | - 'openidchoosefull' => 'Your full name ($1)', |
63 | | - 'openidchooseurl' => 'A name picked from your OpenID ($1)', |
64 | | - 'openidchooseauto' => 'An auto-generated name ($1)', |
65 | | - 'openidchoosemanual' => 'A name of your choice: ', |
66 | | - 'openidconvertinstructions' => 'This form lets you change your user account to use an OpenID URL.', |
67 | | - 'openidconvertsuccess' => 'Successfully converted to OpenID', |
68 | | - 'openidconvertsuccesstext' => 'You have successfully converted your OpenID to $1.', |
69 | | - 'openidconvertyourstext' => 'That is already your OpenID.', |
70 | | - 'openidconvertothertext' => 'That is someone else\'s OpenID.', |
71 | | - 'openidalreadyloggedin' => '<strong>User $1, you are already logged in!</strong>', |
72 | | - 'tog-hideopenid' => 'Hide your <a href="http://openid.net/">OpenID</a> on your user page, if you log in with OpenID.', |
73 | | - 'openidnousername' => 'No username specified.', |
74 | | - 'openidbadusername' => 'Bad username specified.', |
75 | | - 'openidautosubmit' => 'This page includes a form that should be automatically submitted if you have JavaScript enabled. If not, try the "Continue" button.', |
76 | | - 'openidloginlabel' => 'OpenID URL', |
77 | | - 'openidlogininstructions' => |
78 | | - '{{SITENAME}} supports the [http://openid.net/ OpenID] standard for single signon between Web sites. ' . |
79 | | - 'OpenID lets you log into many different Web sites without using a different password for each. (See [http://en.wikipedia.org/wiki/OpenID Wikipedia\'s OpenID article] for more information.) ' . |
80 | | - "\n\n" . |
81 | | - 'If you already have an account on {{SITENAME}}, you can [[Special:Userlogin|log in]] with your username and password as usual. To use OpenID in the future, you can [[Special:OpenIDConvert|convert your account to OpenID]] after you\'ve logged in normally.' . |
82 | | - "\n\n" . |
83 | | - 'There are many [http://wiki.openid.net/Public_OpenID_providers Public OpenID providers], and you may already have an OpenID-enabled account on another service. ' . |
84 | | - "\n\n" . |
85 | | - '; Other wikis : If you have an account on an OpenID-enabled wiki, ' . |
86 | | - 'like [http://wikitravel.org/ Wikitravel], [http://www.wikihow.com/ wikiHow], ' . |
87 | | - '[http://vinismo.com/ Vinismo], [http://aboutus.org/ AboutUs] or [http://kei.ki/ Keiki], ' . |
88 | | - 'you can log in to {{SITENAME}} by entering the \'\'\'full URL\'\'\' of your user page on that other wiki in the box above. For example, \'\'<nowiki>http://kei.ki/en/User:Evan</nowiki>\'\'. ' . |
89 | | - "\n" . |
90 | | - '; [http://openid.yahoo.com/ Yahoo!] : If you have an account with Yahoo!, ' . |
91 | | - 'you can log in to this site by entering your Yahoo!-provided OpenID ' . |
92 | | - 'in the box above. Yahoo! OpenID URLs have the form ' . |
93 | | - '\'\'<nowiki>https://me.yahoo.com/yourusername</nowiki>\'\'. ' . |
94 | | - "\n" . |
95 | | - '; [http://dev.aol.com/aol-and-63-million-openids AOL] : If you have an account with [http://www.aol.com/ AOL], ' . |
96 | | - 'like an [http://www.aim.com/ AIM] account, you can log in to {{SITENAME}} by entering your AOL-provided OpenID ' . |
97 | | - 'in the box above. AOL OpenID URLs have the form ' . |
98 | | - '\'\'<nowiki>http://openid.aol.com/yourusername</nowiki>\'\'. Your username should be all lowercase, no spaces.' . |
99 | | - "\n" . |
100 | | - '; [http://bloggerindraft.blogspot.com/2008/01/new-feature-blogger-as-openid-provider.html Blogger], [http://faq.wordpress.com/2007/03/06/what-is-openid/ Wordpress.com], [http://www.livejournal.com/openid/about.bml LiveJournal], [http://bradfitz.vox.com/library/post/openid-for-vox.html Vox] : ' . |
101 | | - 'If you have a blog on any of these services, enter your blog URL in the box above. ' . |
102 | | - 'For example, \'\'<nowiki>http://yourusername.blogspot.com/</nowiki>\'\', \'\'<nowiki>http://yourusername.wordpress.com/</nowiki>\'\', \'\'<nowiki>http://yourusername.livejournal.com/</nowiki>\'\', or \'\'<nowiki>http://yourusername.vox.com/</nowiki>\'\'.' |
103 | | - ) |
| 28 | +/** English |
| 29 | + * @author Evan Prodromou <evan@prodromou.name> |
| 30 | + */ |
| 31 | +$messages['en'] = array( |
| 32 | + 'openid-desc' => 'Login to the wiki with an [http://openid.net/ OpenID] and login to other OpenID-aware web sites with a wiki user account', |
| 33 | + 'openidlogin' => 'Login with OpenID', |
| 34 | + 'openidfinish' => 'Finish OpenID login', |
| 35 | + 'openidserver' => 'OpenID server', |
| 36 | + 'openidconvert' => 'OpenID converter', |
| 37 | + 'openiderror' => 'Verification error', |
| 38 | + 'openiderrortext' => 'An error occured during verification of the OpenID URL.', |
| 39 | + 'openidconfigerror' => 'OpenID Configuration Error', |
| 40 | + 'openidconfigerrortext' => 'The OpenID storage configuration for this wiki is invalid. |
| 41 | +Please consult this site\'s administrator.', |
| 42 | + 'openidpermission' => 'OpenID permissions error', |
| 43 | + 'openidpermissiontext' => 'The OpenID you provided is not allowed to login to this server.', |
| 44 | + 'openidcancel' => 'Verification cancelled', |
| 45 | + 'openidcanceltext' => 'Verification of the OpenID URL was cancelled.', |
| 46 | + 'openidfailure' => 'Verification failed', |
| 47 | + 'openidfailuretext' => 'Verification of the OpenID URL failed. Error message: "$1"', |
| 48 | + 'openidsuccess' => 'Verification succeeded', |
| 49 | + 'openidsuccesstext' => 'Verification of the OpenID URL succeeded.', |
| 50 | + 'openidusernameprefix' => 'OpenIDUser', |
| 51 | + 'openidserverlogininstructions' => 'Enter your password below to log in to $3 as user $2 (user page $1).', |
| 52 | + 'openidtrustinstructions' => 'Check if you want to share data with $1.', |
| 53 | + 'openidallowtrust' => 'Allow $1 to trust this user account.', |
| 54 | + 'openidnopolicy' => 'Site has not specified a privacy policy.', |
| 55 | + 'openidpolicy' => 'Check the <a target="_new" href="$1">privacy policy</a> for more information.', |
| 56 | + 'openidoptional' => 'Optional', |
| 57 | + 'openidrequired' => 'Required', |
| 58 | + 'openidnickname' => 'Nickname', |
| 59 | + 'openidfullname' => 'Fullname', |
| 60 | + 'openidemail' => 'Email address', |
| 61 | + 'openidlanguage' => 'Language', |
| 62 | + 'openidnotavailable' => 'Your preferred nickname ($1) is already in use by another user.', |
| 63 | + 'openidnotprovided' => 'Your OpenID server did not provide a nickname (either because it cannot, or because you told it not to).', |
| 64 | + 'openidchooseinstructions' => 'All users need a nickname; you can choose one from the options below.', |
| 65 | + 'openidchoosefull' => 'Your full name ($1)', |
| 66 | + 'openidchooseurl' => 'A name picked from your OpenID ($1)', |
| 67 | + 'openidchooseauto' => 'An auto-generated name ($1)', |
| 68 | + 'openidchoosemanual' => 'A name of your choice: ', |
| 69 | + 'openidconvertinstructions' => 'This form lets you change your user account to use an OpenID URL.', |
| 70 | + 'openidconvertsuccess' => 'Successfully converted to OpenID', |
| 71 | + 'openidconvertsuccesstext' => 'You have successfully converted your OpenID to $1.', |
| 72 | + 'openidconvertyourstext' => 'That is already your OpenID.', |
| 73 | + 'openidconvertothertext' => 'That is someone else\'s OpenID.', |
| 74 | + 'openidalreadyloggedin' => '<strong>User $1, you are already logged in!</strong>', |
| 75 | + 'tog-hideopenid' => 'Hide your <a href="http://openid.net/">OpenID</a> on your user page, if you log in with OpenID.', |
| 76 | + 'openidnousername' => 'No username specified.', |
| 77 | + 'openidbadusername' => 'Bad username specified.', |
| 78 | + 'openidautosubmit' => 'This page includes a form that should be automatically submitted if you have JavaScript enabled. |
| 79 | +If not, try the "Continue" button.', |
| 80 | + 'openidloginlabel' => 'OpenID URL', |
| 81 | + 'openidlogininstructions' => '{{SITENAME}} supports the [http://openid.net/ OpenID] standard for single signon between Web sites. |
| 82 | +OpenID lets you log into many different Web sites without using a different password for each. |
| 83 | +(See [http://en.wikipedia.org/wiki/OpenID Wikipedia\'s OpenID article] for more information.) |
| 84 | + |
| 85 | +If you already have an account on {{SITENAME}}, you can [[Special:Userlogin|log in]] with your username and password as usual. To use OpenID in the future, you can [[Special:OpenIDConvert|convert your account to OpenID]] after you\'ve logged in normally. |
| 86 | + |
| 87 | +There are many [http://wiki.openid.net/Public_OpenID_providers Public OpenID providers], and you may already have an OpenID-enabled account on another service. |
| 88 | + |
| 89 | +; Other wikis : If you have an account on an OpenID-enabled wiki, like [http://wikitravel.org/ Wikitravel], [http://www.wikihow.com/ wikiHow], [http://vinismo.com/ Vinismo], [http://aboutus.org/ AboutUs] or [http://kei.ki/ Keiki], you can log in to {{SITENAME}} by entering the \'\'\'full URL\'\'\' of your user page on that other wiki in the box above. For example, \'\'<nowiki>http://kei.ki/en/User:Evan</nowiki>\'\'. |
| 90 | +; [http://openid.yahoo.com/ Yahoo!] : If you have an account with Yahoo!, you can log in to this site by entering your Yahoo!-provided OpenID in the box above. Yahoo! OpenID URLs have the form \'\'<nowiki>https://me.yahoo.com/yourusername</nowiki>\'\'. |
| 91 | +; [http://dev.aol.com/aol-and-63-million-openids AOL] : If you have an account with [http://www.aol.com/ AOL], like an [http://www.aim.com/ AIM] account, you can log in to {{SITENAME}} by entering your AOL-provided OpenID in the box above. AOL OpenID URLs have the form \'\'<nowiki>http://openid.aol.com/yourusername</nowiki>\'\'. Your username should be all lowercase, no spaces. |
| 92 | +; [http://bloggerindraft.blogspot.com/2008/01/new-feature-blogger-as-openid-provider.html Blogger], [http://faq.wordpress.com/2007/03/06/what-is-openid/ Wordpress.com], [http://www.livejournal.com/openid/about.bml LiveJournal], [http://bradfitz.vox.com/library/post/openid-for-vox.html Vox] : If you have a blog on any of these services, enter your blog URL in the box above. For example, \'\'<nowiki>http://yourusername.blogspot.com/</nowiki>\'\', \'\'<nowiki>http://yourusername.wordpress.com/</nowiki>\'\', \'\'<nowiki>http://yourusername.livejournal.com/</nowiki>\'\', or \'\'<nowiki>http://yourusername.vox.com/</nowiki>\'\'.', |
104 | 93 | ); |
Property changes on: trunk/extensions/OpenID/OpenID.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
105 | 94 | + native |
Index: trunk/extensions/OpenID/SpecialOpenIDConvert.body.php |
— | — | @@ -27,16 +27,17 @@ |
28 | 28 | } |
29 | 29 | |
30 | 30 | class SpecialOpenIDConvert extends SpecialOpenID { |
31 | | - |
| 31 | + |
32 | 32 | function SpecialOpenIDConvert() { |
33 | 33 | SpecialPage::SpecialPage("OpenIDConvert"); |
34 | | - self::loadMessages(); |
35 | 34 | } |
36 | 35 | |
37 | 36 | function execute($par) { |
38 | 37 | |
39 | 38 | global $wgRequest, $wgUser, $wgOut; |
40 | 39 | |
| 40 | + wfLoadExtensionMessages( 'OpenID' ); |
| 41 | + |
41 | 42 | $this->setHeaders(); |
42 | 43 | |
43 | 44 | if ($wgUser->getID() == 0) { |
— | — | @@ -59,7 +60,7 @@ |
60 | 61 | } |
61 | 62 | |
62 | 63 | function convert($openid_url) { |
63 | | - |
| 64 | + |
64 | 65 | global $wgUser, $wgOut; |
65 | 66 | |
66 | 67 | # Expand Interwiki |
— | — | @@ -67,14 +68,14 @@ |
68 | 69 | $openid_url = $this->interwikiExpand($openid_url); |
69 | 70 | |
70 | 71 | # Is this ID allowed to log in? |
71 | | - |
| 72 | + |
72 | 73 | if (!$this->CanLogin($openid_url)) { |
73 | 74 | $wgOut->showErrorPage('openidpermission', 'openidpermissiontext'); |
74 | 75 | return; |
75 | 76 | } |
76 | 77 | |
77 | 78 | # Is this ID already taken? |
78 | | - |
| 79 | + |
79 | 80 | $other = $this->getUser($openid_url); |
80 | 81 | |
81 | 82 | if (isset($other)) { |
— | — | @@ -116,7 +117,7 @@ |
117 | 118 | global $wgUser, $wgOut; |
118 | 119 | |
119 | 120 | $consumer = $this->getConsumer(); |
120 | | - |
| 121 | + |
121 | 122 | $response = $consumer->complete($this->scriptUrl('OpenIDConvert/Finish')); |
122 | 123 | |
123 | 124 | if (!isset($response)) { |
Index: trunk/extensions/OpenID/SpecialOpenIDFinish.body.php |
— | — | @@ -30,16 +30,17 @@ |
31 | 31 | require_once("Auth/Yadis/XRI.php"); |
32 | 32 | |
33 | 33 | class SpecialOpenIDFinish extends SpecialOpenID { |
34 | | - |
| 34 | + |
35 | 35 | function SpecialOpenIDFinish() { |
36 | 36 | SpecialPage::SpecialPage("OpenIDFinish", '', false); |
37 | | - self::loadMessages(); |
38 | 37 | } |
39 | 38 | |
40 | 39 | function execute($par) { |
41 | 40 | |
42 | 41 | global $wgUser, $wgOut, $wgRequest; |
43 | 42 | |
| 43 | + wfLoadExtensionMessages( 'OpenID' ); |
| 44 | + |
44 | 45 | $this->setHeaders(); |
45 | 46 | |
46 | 47 | # Shouldn't work if you're already logged in. |
— | — | @@ -111,7 +112,7 @@ |
112 | 113 | break; |
113 | 114 | case Auth_OpenID_FAILURE: |
114 | 115 | wfDebug("OpenID: error message '" . $response->message . "'\n"); |
115 | | - $wgOut->showErrorPage('openidfailure', 'openidfailuretext', |
| 116 | + $wgOut->showErrorPage('openidfailure', 'openidfailuretext', |
116 | 117 | array(($response->message) ? $response->message : '')); |
117 | 118 | break; |
118 | 119 | case Auth_OpenID_SUCCESS: |
— | — | @@ -119,7 +120,7 @@ |
120 | 121 | $openid = $response->getDisplayIdentifier(); |
121 | 122 | $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response); |
122 | 123 | $sreg = $sreg_resp->contents(); |
123 | | - |
| 124 | + |
124 | 125 | if (!isset($openid)) { |
125 | 126 | $wgOut->showErrorPage('openiderror', 'openiderrortext'); |
126 | 127 | return; |
— | — | @@ -601,7 +602,7 @@ |
602 | 603 | function returnTo() { |
603 | 604 | return $_SESSION['openid_consumer_returnto']; |
604 | 605 | } |
605 | | - |
| 606 | + |
606 | 607 | function setReturnTo($returnto) { |
607 | 608 | $_SESSION['openid_consumer_returnto'] = $returnto; |
608 | 609 | } |
— | — | @@ -633,5 +634,3 @@ |
634 | 635 | } |
635 | 636 | } |
636 | 637 | } |
637 | | - |
638 | | -?> |
Property changes on: trunk/extensions/OpenID/SpecialOpenIDFinish.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
639 | 638 | + native |
Index: trunk/extensions/OpenID/SpecialOpenIDXRDS.body.php |
— | — | @@ -32,14 +32,15 @@ |
33 | 33 | |
34 | 34 | function SpecialOpenIDXRDS() { |
35 | 35 | SpecialPage::SpecialPage("OpenIDXRDS", '', false); |
36 | | - self::loadMessages(); |
37 | 36 | } |
38 | 37 | |
39 | 38 | # $par is a user name |
40 | | - |
| 39 | + |
41 | 40 | function execute($par) { |
42 | 41 | global $wgOut; |
43 | 42 | |
| 43 | + wfLoadExtensionMessages( 'OpenID' ); |
| 44 | + |
44 | 45 | // XRDS preamble XML. |
45 | 46 | $xml_template = array('<?xml version="1.0" encoding="UTF-8"?>', |
46 | 47 | '<xrds:XRDS', |
— | — | @@ -49,19 +50,19 @@ |
50 | 51 | '<XRD>'); |
51 | 52 | |
52 | 53 | # Check to see if the parameter is really a user name |
53 | | - |
| 54 | + |
54 | 55 | if (!$par) { |
55 | 56 | wfHttpError(404, "Not Found", wfMsg('openidnousername')); |
56 | 57 | } |
57 | 58 | |
58 | 59 | $user = User::newFromName($par); |
59 | | - |
| 60 | + |
60 | 61 | if (!$user || $user->getID() == 0) { |
61 | 62 | wfHttpError(404, "Not Found", wfMsg('openidbadusername')); |
62 | 63 | } |
63 | | - |
| 64 | + |
64 | 65 | // Generate the user page URL. |
65 | | - |
| 66 | + |
66 | 67 | $user_title = Title::makeTitle(NS_USER, $user->getName()); |
67 | 68 | $user_url = $user_title->getFullURL(); |
68 | 69 | |
— | — | @@ -79,7 +80,7 @@ |
80 | 81 | 'http://specs.openid.net/auth/2.0/signon'), |
81 | 82 | 'delegate' => $user_url), |
82 | 83 | ); |
83 | | - |
| 84 | + |
84 | 85 | // Generate <Service> elements into $service_text. |
85 | 86 | $service_text = "\n"; |
86 | 87 | foreach ($services as $service) { |
— | — | @@ -93,9 +94,9 @@ |
94 | 95 | implode("\n", $types), |
95 | 96 | ' </Service>')); |
96 | 97 | } |
97 | | - |
| 98 | + |
98 | 99 | $wgOut->disable(); |
99 | | - |
| 100 | + |
100 | 101 | // Print content-type and XRDS XML. |
101 | 102 | header("Content-Type", "application/xrds+xml"); |
102 | 103 | print implode("\n", $xml_template); |
Property changes on: trunk/extensions/OpenID/SpecialOpenIDXRDS.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
103 | 104 | + native |
Index: trunk/extensions/OpenID/OpenID.setup.php |
— | — | @@ -26,21 +26,21 @@ |
27 | 27 | exit( 1 ); |
28 | 28 | } |
29 | 29 | |
30 | | -define('MEDIAWIKI_OPENID_VERSION', '0.8.0'); |
| 30 | +define('MEDIAWIKI_OPENID_VERSION', '0.8.1'); |
31 | 31 | |
32 | 32 | # CONFIGURATION VARIABLES |
33 | 33 | |
34 | 34 | # Whether to hide the "Login with OpenID link" link; set to true if you already have this link in your skin. |
35 | | - |
| 35 | + |
36 | 36 | $wgHideOpenIDLoginLink = false; |
37 | 37 | |
38 | 38 | # Location of the OpenID login logo. You can copy this to your server if you want. |
39 | | - |
| 39 | + |
40 | 40 | $wgOpenIDLoginLogoUrl = 'http://www.openid.net/login-bg.gif'; |
41 | | - |
42 | | -# Whether to show the OpenID identity URL on a user's home page. Possible values are 'always', 'never', or 'user' |
| 41 | + |
| 42 | +# Whether to show the OpenID identity URL on a user's home page. Possible values are 'always', 'never', or 'user' |
43 | 43 | # 'user' lets the user decide. |
44 | | - |
| 44 | + |
45 | 45 | $wgOpenIDShowUrlOnUserPage = 'user'; |
46 | 46 | |
47 | 47 | # These are trust roots that we don't bother asking users |
— | — | @@ -98,15 +98,17 @@ |
99 | 99 | |
100 | 100 | $wgExtensionFunctions[] = 'setupOpenID'; |
101 | 101 | |
102 | | -$wgExtensionCredits['other'][] = array('name' => 'OpenID', |
103 | | - 'version' => MEDIAWIKI_OPENID_VERSION, |
104 | | - 'author' => 'Evan Prodromou', |
105 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:OpenID', |
106 | | - 'description' => 'lets users login to the wiki with an ' . |
107 | | - ' [http://openid.net/ OpenID] ' . |
108 | | - 'and login to other OpenID-aware Web sites ' . |
109 | | - 'with their wiki user account'); |
| 102 | +$wgExtensionMessagesFiles['OpenID'] = dirname(__FILE__) . '/OpenID.i18n.php'; |
110 | 103 | |
| 104 | +$wgExtensionCredits['other'][] = array( |
| 105 | + 'name' => 'OpenID', |
| 106 | + 'version' => MEDIAWIKI_OPENID_VERSION, |
| 107 | + 'author' => 'Evan Prodromou', |
| 108 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:OpenID', |
| 109 | + 'description' => 'Lets users login to the wiki with an [http://openid.net/ OpenID] and login to other OpenID-aware Web sites with their wiki user account', |
| 110 | + 'descriptiomsg' => 'openid-desc', |
| 111 | +); |
| 112 | + |
111 | 113 | function OpenIDGetServerPath() { |
112 | 114 | $rel = 'Auth/OpenID/Server.php'; |
113 | 115 | |
— | — | @@ -140,9 +142,9 @@ |
141 | 143 | $wgHooks['UserToggles'][] = 'OpenIDUserToggles'; |
142 | 144 | $wgHooks['ArticleViewHeader'][] = 'OpenIDArticleViewHeader'; |
143 | 145 | # Load the i18n messages |
144 | | - $wgHooks['LoadAllMessages'][] = 'SpecialOpenID::loadMessages'; |
| 146 | + wfLoadExtensionMessages( 'OpenID' ); |
145 | 147 | # Add any aliases for the special page. |
146 | | - $wgHooks['LanguageGetSpecialPageAliases'][] = 'SpecialOpenID::LocalizedPageName'; |
| 148 | + $wgHooks['LanguageGetSpecialPageAliases'][] = 'SpecialOpenID::LocalizedPageName'; |
147 | 149 | # Typo in versions of MW earlier than 1.11.x (?) |
148 | 150 | $wgHooks['LangugeGetSpecialPageAliases'][] = 'SpecialOpenID::LocalizedPageName'; # Add any aliases for the special page. |
149 | 151 | } |
— | — | @@ -151,15 +153,15 @@ |
152 | 154 | |
153 | 155 | function OpenIDArticleViewHeader(&$article, &$outputDone, &$pcache ) { |
154 | 156 | global $wgOut; |
155 | | - |
| 157 | + |
156 | 158 | $nt = $article->getTitle(); |
157 | | - |
| 159 | + |
158 | 160 | // If the page being viewed is a user page, |
159 | 161 | // generate the openid.server META tag and output |
160 | 162 | // the X-XRDS-Location. See the OpenIDXRDS |
161 | 163 | // special page for the XRDS output / generation |
162 | 164 | // logic. |
163 | | - |
| 165 | + |
164 | 166 | if ($nt && |
165 | 167 | ($nt->getNamespace() == NS_USER) && |
166 | 168 | strpos($nt->getText(), '/') === false) |
— | — | @@ -169,12 +171,12 @@ |
170 | 172 | $openid = SpecialOpenID::getUserUrl($user); |
171 | 173 | if (isset($openid) && strlen($openid) != 0) { |
172 | 174 | global $wgOpenIDShowUrlOnUserPage; |
173 | | - |
| 175 | + |
174 | 176 | if ($wgOpenIDShowUrlOnUserPage == 'always' || |
175 | 177 | ($wgOpenIDShowUrlOnUserPage == 'user' && !$user->getOption('hideopenid'))) |
176 | 178 | { |
177 | 179 | global $wgOpenIDLoginLogoUrl; |
178 | | - |
| 180 | + |
179 | 181 | $url = SpecialOpenID::OpenIDToUrl($openid); |
180 | 182 | $disp = htmlspecialchars($openid); |
181 | 183 | $wgOut->setSubtitle("<span class='subpages'>" . |
— | — | @@ -194,36 +196,36 @@ |
195 | 197 | } |
196 | 198 | } |
197 | 199 | } |
198 | | - |
| 200 | + |
199 | 201 | return TRUE; |
200 | 202 | } |
201 | 203 | |
202 | 204 | function OpenIDPersonalUrls(&$personal_urls, &$title) { |
203 | 205 | global $wgHideOpenIDLoginLink, $wgUser, $wgLang, $wgOut; |
204 | | - |
| 206 | + |
205 | 207 | if (!$wgHideOpenIDLoginLink && $wgUser->getID() == 0) { |
206 | 208 | $wgOut->addHeadItem('openidloginstyle', OpenIDLoginStyle()); |
207 | 209 | $sk = $wgUser->getSkin(); |
208 | 210 | $returnto = ($title->getPrefixedUrl() == $wgLang->specialPage( 'Userlogout' )) ? |
209 | 211 | '' : ('returnto=' . $title->getPrefixedURL()); |
210 | | - |
| 212 | + |
211 | 213 | $personal_urls['openidlogin'] = array( |
212 | 214 | 'text' => wfMsg('openidlogin'), |
213 | 215 | 'href' => $sk->makeSpecialUrl( 'OpenIDLogin', $returnto ), |
214 | 216 | 'active' => $title->isSpecial( 'OpenIDLogin' ) |
215 | 217 | ); |
216 | 218 | } |
217 | | - |
| 219 | + |
218 | 220 | return true; |
219 | 221 | } |
220 | 222 | |
221 | 223 | function OpenIDUserToggles(&$extraToggles) { |
222 | 224 | global $wgOpenIDShowUrlOnUserPage; |
223 | | - |
| 225 | + |
224 | 226 | if ($wgOpenIDShowUrlOnUserPage == 'user') { |
225 | 227 | $extraToggles[] = 'hideopenid'; |
226 | 228 | } |
227 | | - |
| 229 | + |
228 | 230 | return true; |
229 | 231 | } |
230 | 232 | |
Index: trunk/extensions/OpenID/openid_table.sql |
— | — | @@ -5,4 +5,3 @@ |
6 | 6 | PRIMARY KEY uoi_openid (uoi_openid), |
7 | 7 | UNIQUE INDEX uoi_user (uoi_user) |
8 | 8 | ) TYPE=InnoDB; |
9 | | - |
Property changes on: trunk/extensions/OpenID/OpenID.php |
___________________________________________________________________ |
Added: svn:eol-style |
10 | 9 | + native |
Index: trunk/extensions/OpenID/SpecialOpenIDServer.body.php |
— | — | @@ -48,13 +48,14 @@ |
49 | 49 | |
50 | 50 | function SpecialOpenIDServer() { |
51 | 51 | SpecialPage::SpecialPage("OpenIDServer", '', false); |
52 | | - self::loadMessages(); |
53 | 52 | } |
54 | 53 | |
55 | 54 | function execute($par) { |
56 | 55 | |
57 | 56 | global $wgOut; |
58 | 57 | |
| 58 | + wfLoadExtensionMessages( 'OpenID' ); |
| 59 | + |
59 | 60 | $this->setHeaders(); |
60 | 61 | |
61 | 62 | $server =& $this->getServer(); |
— | — | @@ -735,4 +736,3 @@ |
736 | 737 | return $this->fullURL('OpenIDServer'); |
737 | 738 | } |
738 | 739 | } |
739 | | - |
Index: trunk/extensions/OpenID/optionToTable.php |
— | — | @@ -47,4 +47,3 @@ |
48 | 48 | OpenIDSetUserUrl($user, $user->getOption('openid_url')); |
49 | 49 | } |
50 | 50 | $dbr->freeResult($res); |
51 | | - |
Index: trunk/extensions/OpenID/SpecialOpenIDLogin.body.php |
— | — | @@ -28,17 +28,18 @@ |
29 | 29 | require_once("Auth/OpenID/Consumer.php"); |
30 | 30 | |
31 | 31 | class SpecialOpenIDLogin extends SpecialOpenID { |
32 | | - |
| 32 | + |
33 | 33 | function SpecialOpenIDLogin() { |
34 | 34 | SpecialPage::SpecialPage("OpenIDLogin"); |
35 | | - self::loadMessages(); |
36 | 35 | } |
37 | 36 | |
38 | 37 | function execute($par) { |
39 | 38 | global $wgRequest, $wgUser, $wgOut; |
40 | 39 | |
| 40 | + wfLoadExtensionMessages( 'OpenID' ); |
| 41 | + |
41 | 42 | $this->setHeaders(); |
42 | | - |
| 43 | + |
43 | 44 | if ($wgUser->getID() != 0) { |
44 | 45 | $this->alreadyLoggedIn(); |
45 | 46 | return; |
— | — | @@ -47,9 +48,9 @@ |
48 | 49 | if ($wgRequest->getText('returnto')) { |
49 | 50 | $this->setReturnTo($wgRequest->getText('returnto')); |
50 | 51 | } |
51 | | - |
| 52 | + |
52 | 53 | $openid_url = $wgRequest->getText('openid_url'); |
53 | | - |
| 54 | + |
54 | 55 | if (isset($openid_url) && strlen($openid_url) > 0) { |
55 | 56 | $this->login($openid_url); |
56 | 57 | } else { |
— | — | @@ -167,10 +168,8 @@ |
168 | 169 | function returnTo() { |
169 | 170 | return $_SESSION['openid_consumer_returnto']; |
170 | 171 | } |
171 | | - |
| 172 | + |
172 | 173 | function setReturnTo($returnto) { |
173 | 174 | $_SESSION['openid_consumer_returnto'] = $returnto; |
174 | 175 | } |
175 | 176 | } |
176 | | - |
177 | | -?> |
Index: trunk/extensions/OpenID/README |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | * The extension has been converted to use a clumsy and perverse |
150 | 150 | OOP-like structure, with one class per special page. Most function |
151 | 151 | names have been changed to methods of these classes. If you used |
152 | | - them, look around for their replacements. |
| 152 | + them, look around for their replacements. |
153 | 153 | * The extension has been converted to use the autoloading features |
154 | 154 | of MediaWiki, which means that you need to require() the files |
155 | 155 | directly if you really want to use their code. Or you might get |
— | — | @@ -281,14 +281,14 @@ |
282 | 282 | link, like in your skin. Note that it will *not* prevent login if |
283 | 283 | the user navigates to Special:OpenIDLogin directly; it's simply |
284 | 284 | cosmetic. This is mostly a backwards-compatibility option. |
285 | | - |
| 285 | + |
286 | 286 | * $wgOpenIDLoginLogoUrl -- Url of the OpenID login logo. Defaults to |
287 | 287 | 'http://www.openid.net/login-bg.gif', but you may want to move it to |
288 | 288 | a local URL, or an URL on a CDN, if that kind of thing floats your |
289 | 289 | boat. |
290 | 290 | |
291 | 291 | * $wgOpenIDShowUrlOnUserPage -- whether to show the OpenID identity URL |
292 | | - on a user's home page. Possible values are 'always', 'never', or 'user' |
| 292 | + on a user's home page. Possible values are 'always', 'never', or 'user' |
293 | 293 | (lets the user decide). Default is 'user'. |
294 | 294 | |
295 | 295 | == Skins == |
— | — | @@ -331,4 +331,3 @@ |
332 | 332 | control panel |
333 | 333 | * Auto-login if you've logged in before with an OpenID, and are logged |
334 | 334 | into that account now |
335 | | - |