r31821 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r31820‎ | r31821 | r31822 >
Date:21:25, 11 March 2008
Author:siebrand
Status:old
Tags:
Comment:
* use wfLoadExtensionMessages
* add descriptionmsg
* some reformatting in i18n messages
* remove EOL whitespace
* svn prop eol-style:native where not set

FIXME: Strict Standards: Non-static method SpecialOpenID::LocalizedPageName() cannot be called statically
Modified paths:
  • /trunk/extensions/OpenID/OpenID.i18n.php (modified) (history)
  • /trunk/extensions/OpenID/OpenID.php (modified) (history)
  • /trunk/extensions/OpenID/OpenID.setup.php (modified) (history)
  • /trunk/extensions/OpenID/README (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenID.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDConvert.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDFinish.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDLogin.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDServer.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDXRDS.body.php (modified) (history)
  • /trunk/extensions/OpenID/openid_table.sql (modified) (history)
  • /trunk/extensions/OpenID/optionToTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/SpecialOpenID.body.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * SpecialOpenID.body.php -- Superclass for all
 4+ * SpecialOpenID.body.php -- Superclass for all
55 * Copyright 2006,2007 Internet Brands (http://www.internetbrands.com/)
66 * Copyright 2008 by Evan Prodromou (http://evan.prodromou.name/)
77 *
@@ -30,15 +30,15 @@
3131 require_once("Auth/OpenID/FileStore.php");
3232
3333 class SpecialOpenID extends SpecialPage {
34 -
 34+
3535 function getOpenIDStore($storeType, $prefix, $options) {
3636 global $wgOut;
3737
3838 # FIXME: support other kinds of store
3939 # XXX: used to support memc, now use memcached from php-openid
40 -
 40+
4141 switch ($storeType) {
42 -
 42+
4343 case 'file':
4444 # Auto-create path if it doesn't exist
4545 if (!is_dir($options['path'])) {
@@ -53,7 +53,7 @@
5454 $wgOut->showErrorPage('openidconfigerror', 'openidconfigerrortext');
5555 }
5656 }
57 -
 57+
5858 function xriBase($xri) {
5959 if (substr($xri, 0, 6) == 'xri://') {
6060 return substr($xri, 6);
@@ -61,11 +61,11 @@
6262 return $xri;
6363 }
6464 }
65 -
 65+
6666 function xriToUrl($xri) {
6767 return 'http://xri.net/' . OpenIDXriBase($xri);
6868 }
69 -
 69+
7070 function OpenIDToUrl($openid) {
7171 /* ID is either an URL already or an i-name */
7272 if (Auth_Yadis_identifierScheme($openid) == 'XRI') {
@@ -74,36 +74,20 @@
7575 return $openid;
7676 }
7777 }
78 -
 78+
7979 function LocalizedPageName(&$specialPageArray, $code) {
80 -
 80+
8181 # The localized title of the special page is among the messages of the extension:
82 - SpecialOpenID::loadMessages();
 82+ wfLoadExtensionMessages( 'OpenID' );
8383 $text = wfMsg('openidlogin');
84 -
 84+
8585 # Convert from title in text form to DBKey and put it into the alias array:
8686 $title = Title::newFromText($text);
8787 $specialPageArray['Form'][] = $title->getDBKey();
88 -
 88+
8989 return true;
9090 }
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+
10892 function interwikiExpand($openid_url) {
10993 # try to make it into a title object
11094 $nt = Title::newFromText($openid_url);
@@ -115,10 +99,10 @@
116100 return $openid_url;
117101 }
118102 }
119 -
 103+
120104 function getUserUrl($user) {
121105 $openid_url = null;
122 -
 106+
123107 if (isset($user) && $user->getId() != 0) {
124108 global $wgSharedDB, $wgDBprefix;
125109 if (isset($wgSharedDB)) {
@@ -126,16 +110,16 @@
127111 } else {
128112 $tableName = 'user_openid';
129113 }
130 -
 114+
131115 $dbr =& wfGetDB( DB_SLAVE );
132116 $res = $dbr->select(array($tableName),
133117 array('uoi_openid'),
134118 array('uoi_user' => $user->getId()),
135119 'OpenIDGetUserUrl');
136 -
 120+
137121 # This should return 0 or 1 result, since user is unique
138122 # in the table.
139 -
 123+
140124 while ($res && $row = $dbr->fetchObject($res)) {
141125 $openid_url = $row->uoi_openid;
142126 }
@@ -143,19 +127,19 @@
144128 }
145129 return $openid_url;
146130 }
147 -
 131+
148132 # Login, Finish
149 -
 133+
150134 function getConsumer() {
151135 global $wgOpenIDConsumerStoreType, $wgOpenIDConsumerStorePath;
152 -
 136+
153137 $store = $this->getOpenIDStore($wgOpenIDConsumerStoreType,
154138 'consumer',
155139 array('path' => $wgOpenIDConsumerStorePath));
156 -
 140+
157141 return new Auth_OpenID_Consumer($store);
158142 }
159 -
 143+
160144 function fullUrl($title) {
161145 $nt = Title::makeTitleSafe(NS_SPECIAL, $title);
162146 if (isset($nt)) {
@@ -164,7 +148,7 @@
165149 return NULL;
166150 }
167151 }
168 -
 152+
169153 function scriptUrl($title) {
170154 global $wgServer, $wgScript;
171155 $nt = Title::makeTitleSafe(NS_SPECIAL, $title);
@@ -175,15 +159,15 @@
176160 return $url;
177161 }
178162 }
179 -
 163+
180164 function canLogin($openid_url) {
181 -
 165+
182166 global $wgOpenIDConsumerDenyByDefault, $wgOpenIDConsumerAllow, $wgOpenIDConsumerDeny;
183 -
 167+
184168 if ($this->isLocalUrl($openid_url)) {
185169 return false;
186170 }
187 -
 171+
188172 if ($wgOpenIDConsumerDenyByDefault) {
189173 $canLogin = false;
190174 foreach ($wgOpenIDConsumerAllow as $allow) {
@@ -219,29 +203,29 @@
220204 }
221205 return $canLogin;
222206 }
223 -
 207+
224208 function isLocalUrl($url) {
225 -
 209+
226210 global $wgServer, $wgArticlePath;
227 -
 211+
228212 $pattern = $wgServer . $wgArticlePath;
229213 $pattern = str_replace('$1', '(.*)', $pattern);
230214 $pattern = str_replace('?', '\?', $pattern);
231 -
 215+
232216 return preg_match('|^' . $pattern . '$|', $url);
233217 }
234 -
 218+
235219 # Find the user with the given openid, if any
236 -
 220+
237221 function getUser($openid) {
238222 global $wgSharedDB, $wgDBprefix;
239 -
 223+
240224 if (isset($wgSharedDB)) {
241225 $tableName = "`$wgSharedDB`.${wgDBprefix}user_openid";
242226 } else {
243227 $tableName = 'user_openid';
244228 }
245 -
 229+
246230 $dbr =& wfGetDB( DB_SLAVE );
247231 $id = $dbr->selectField($tableName, 'uoi_user',
248232 array('uoi_openid' => $openid));
@@ -253,22 +237,22 @@
254238 }
255239 }
256240 function login($openid_url, $finish_page = 'OpenIDFinish') {
257 -
 241+
258242 global $wgUser, $wgTrustRoot, $wgOut;
259 -
 243+
260244 # If it's an interwiki link, expand it
261 -
 245+
262246 $openid_url = $this->interwikiExpand($openid_url);
263 -
 247+
264248 # Check if the URL is allowed
265 -
 249+
266250 if (!$this->canLogin($openid_url)) {
267251 $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
268252 return;
269253 }
270 -
 254+
271255 $sk = $wgUser->getSkin();
272 -
 256+
273257 if (isset($wgTrustRoot)) {
274258 $trust_root = $wgTrustRoot;
275259 } else {
@@ -276,61 +260,61 @@
277261 $root_article = str_replace('$1', '', $wgArticlePath);
278262 $trust_root = $wgServer . $root_article;
279263 }
280 -
 264+
281265 $consumer = $this->getConsumer();
282 -
 266+
283267 if (!$consumer) {
284268 $wgOut->showErrorPage('openiderror', 'openiderrortext');
285269 return;
286270 }
287 -
 271+
288272 # Make sure the user has a session!
289 -
 273+
290274 global $wgSessionStarted;
291 -
 275+
292276 if (!$wgSessionStarted) {
293277 $wgUser->SetupSession();
294278 }
295 -
 279+
296280 $auth_request = $consumer->begin($openid_url);
297 -
 281+
298282 // Handle failure status return values.
299283 if (!$auth_request) {
300284 $wgOut->showErrorPage('openiderror', 'openiderrortext');
301285 return;
302286 }
303 -
 287+
304288 # Check the processed URLs, too
305 -
 289+
306290 $endpoint = $auth_request->endpoint;
307 -
 291+
308292 if (isset($endpoint)) {
309293 # Check if the URL is allowed
310 -
 294+
311295 if (isset($endpoint->identity_url) && !$this->canLogin($endpoint->identity_url)) {
312296 $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
313297 return;
314298 }
315 -
 299+
316300 if (isset($endpoint->delegate) && !$this->canLogin($endpoint->delegate)) {
317301 $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
318302 return;
319303 }
320304 }
321 -
 305+
322306 $sreg_request = Auth_OpenID_SRegRequest::build(
323307 // Required
324308 array(),
325309 // Optional
326310 array('nickname','email',
327311 'fullname','language','timezone'));
328 -
 312+
329313 if ($sreg_request) {
330314 $auth_request->addExtension($sreg_request);
331315 }
332 -
 316+
333317 $process_url = $this->scriptUrl($finish_page);
334 -
 318+
335319 if ($auth_request->shouldSendRedirect()) {
336320 $redirect_url = $auth_request->redirectURL($trust_root,
337321 $process_url);
@@ -345,7 +329,7 @@
346330 $form_id = 'openid_message';
347331 $form_html = $auth_request->formMarkup($trust_root, $process_url,
348332 false, array('id' => $form_id));
349 -
 333+
350334 // Display an error if the form markup couldn't be generated;
351335 // otherwise, render the HTML.
352336 if (Auth_OpenID::isFailure($form_html)) {
Property changes on: trunk/extensions/OpenID/SpecialOpenID.body.php
___________________________________________________________________
Added: svn:eol-style
353337 + native
Index: trunk/extensions/OpenID/OpenID.i18n.php
@@ -22,82 +22,71 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI')) {
27 - exit( 1 );
28 -}
 26+$messages = array();
2927
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>\'\'.',
10493 );
Property changes on: trunk/extensions/OpenID/OpenID.i18n.php
___________________________________________________________________
Added: svn:eol-style
10594 + native
Index: trunk/extensions/OpenID/SpecialOpenIDConvert.body.php
@@ -27,16 +27,17 @@
2828 }
2929
3030 class SpecialOpenIDConvert extends SpecialOpenID {
31 -
 31+
3232 function SpecialOpenIDConvert() {
3333 SpecialPage::SpecialPage("OpenIDConvert");
34 - self::loadMessages();
3534 }
3635
3736 function execute($par) {
3837
3938 global $wgRequest, $wgUser, $wgOut;
4039
 40+ wfLoadExtensionMessages( 'OpenID' );
 41+
4142 $this->setHeaders();
4243
4344 if ($wgUser->getID() == 0) {
@@ -59,7 +60,7 @@
6061 }
6162
6263 function convert($openid_url) {
63 -
 64+
6465 global $wgUser, $wgOut;
6566
6667 # Expand Interwiki
@@ -67,14 +68,14 @@
6869 $openid_url = $this->interwikiExpand($openid_url);
6970
7071 # Is this ID allowed to log in?
71 -
 72+
7273 if (!$this->CanLogin($openid_url)) {
7374 $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
7475 return;
7576 }
7677
7778 # Is this ID already taken?
78 -
 79+
7980 $other = $this->getUser($openid_url);
8081
8182 if (isset($other)) {
@@ -116,7 +117,7 @@
117118 global $wgUser, $wgOut;
118119
119120 $consumer = $this->getConsumer();
120 -
 121+
121122 $response = $consumer->complete($this->scriptUrl('OpenIDConvert/Finish'));
122123
123124 if (!isset($response)) {
Index: trunk/extensions/OpenID/SpecialOpenIDFinish.body.php
@@ -30,16 +30,17 @@
3131 require_once("Auth/Yadis/XRI.php");
3232
3333 class SpecialOpenIDFinish extends SpecialOpenID {
34 -
 34+
3535 function SpecialOpenIDFinish() {
3636 SpecialPage::SpecialPage("OpenIDFinish", '', false);
37 - self::loadMessages();
3837 }
3938
4039 function execute($par) {
4140
4241 global $wgUser, $wgOut, $wgRequest;
4342
 43+ wfLoadExtensionMessages( 'OpenID' );
 44+
4445 $this->setHeaders();
4546
4647 # Shouldn't work if you're already logged in.
@@ -111,7 +112,7 @@
112113 break;
113114 case Auth_OpenID_FAILURE:
114115 wfDebug("OpenID: error message '" . $response->message . "'\n");
115 - $wgOut->showErrorPage('openidfailure', 'openidfailuretext',
 116+ $wgOut->showErrorPage('openidfailure', 'openidfailuretext',
116117 array(($response->message) ? $response->message : ''));
117118 break;
118119 case Auth_OpenID_SUCCESS:
@@ -119,7 +120,7 @@
120121 $openid = $response->getDisplayIdentifier();
121122 $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
122123 $sreg = $sreg_resp->contents();
123 -
 124+
124125 if (!isset($openid)) {
125126 $wgOut->showErrorPage('openiderror', 'openiderrortext');
126127 return;
@@ -601,7 +602,7 @@
602603 function returnTo() {
603604 return $_SESSION['openid_consumer_returnto'];
604605 }
605 -
 606+
606607 function setReturnTo($returnto) {
607608 $_SESSION['openid_consumer_returnto'] = $returnto;
608609 }
@@ -633,5 +634,3 @@
634635 }
635636 }
636637 }
637 -
638 -?>
Property changes on: trunk/extensions/OpenID/SpecialOpenIDFinish.body.php
___________________________________________________________________
Added: svn:eol-style
639638 + native
Index: trunk/extensions/OpenID/SpecialOpenIDXRDS.body.php
@@ -32,14 +32,15 @@
3333
3434 function SpecialOpenIDXRDS() {
3535 SpecialPage::SpecialPage("OpenIDXRDS", '', false);
36 - self::loadMessages();
3736 }
3837
3938 # $par is a user name
40 -
 39+
4140 function execute($par) {
4241 global $wgOut;
4342
 43+ wfLoadExtensionMessages( 'OpenID' );
 44+
4445 // XRDS preamble XML.
4546 $xml_template = array('<?xml version="1.0" encoding="UTF-8"?>',
4647 '<xrds:XRDS',
@@ -49,19 +50,19 @@
5051 '<XRD>');
5152
5253 # Check to see if the parameter is really a user name
53 -
 54+
5455 if (!$par) {
5556 wfHttpError(404, "Not Found", wfMsg('openidnousername'));
5657 }
5758
5859 $user = User::newFromName($par);
59 -
 60+
6061 if (!$user || $user->getID() == 0) {
6162 wfHttpError(404, "Not Found", wfMsg('openidbadusername'));
6263 }
63 -
 64+
6465 // Generate the user page URL.
65 -
 66+
6667 $user_title = Title::makeTitle(NS_USER, $user->getName());
6768 $user_url = $user_title->getFullURL();
6869
@@ -79,7 +80,7 @@
8081 'http://specs.openid.net/auth/2.0/signon'),
8182 'delegate' => $user_url),
8283 );
83 -
 84+
8485 // Generate <Service> elements into $service_text.
8586 $service_text = "\n";
8687 foreach ($services as $service) {
@@ -93,9 +94,9 @@
9495 implode("\n", $types),
9596 ' </Service>'));
9697 }
97 -
 98+
9899 $wgOut->disable();
99 -
 100+
100101 // Print content-type and XRDS XML.
101102 header("Content-Type", "application/xrds+xml");
102103 print implode("\n", $xml_template);
Property changes on: trunk/extensions/OpenID/SpecialOpenIDXRDS.body.php
___________________________________________________________________
Added: svn:eol-style
103104 + native
Index: trunk/extensions/OpenID/OpenID.setup.php
@@ -26,21 +26,21 @@
2727 exit( 1 );
2828 }
2929
30 -define('MEDIAWIKI_OPENID_VERSION', '0.8.0');
 30+define('MEDIAWIKI_OPENID_VERSION', '0.8.1');
3131
3232 # CONFIGURATION VARIABLES
3333
3434 # Whether to hide the "Login with OpenID link" link; set to true if you already have this link in your skin.
35 -
 35+
3636 $wgHideOpenIDLoginLink = false;
3737
3838 # Location of the OpenID login logo. You can copy this to your server if you want.
39 -
 39+
4040 $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'
4343 # 'user' lets the user decide.
44 -
 44+
4545 $wgOpenIDShowUrlOnUserPage = 'user';
4646
4747 # These are trust roots that we don't bother asking users
@@ -98,15 +98,17 @@
9999
100100 $wgExtensionFunctions[] = 'setupOpenID';
101101
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';
110103
 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+
111113 function OpenIDGetServerPath() {
112114 $rel = 'Auth/OpenID/Server.php';
113115
@@ -140,9 +142,9 @@
141143 $wgHooks['UserToggles'][] = 'OpenIDUserToggles';
142144 $wgHooks['ArticleViewHeader'][] = 'OpenIDArticleViewHeader';
143145 # Load the i18n messages
144 - $wgHooks['LoadAllMessages'][] = 'SpecialOpenID::loadMessages';
 146+ wfLoadExtensionMessages( 'OpenID' );
145147 # Add any aliases for the special page.
146 - $wgHooks['LanguageGetSpecialPageAliases'][] = 'SpecialOpenID::LocalizedPageName';
 148+ $wgHooks['LanguageGetSpecialPageAliases'][] = 'SpecialOpenID::LocalizedPageName';
147149 # Typo in versions of MW earlier than 1.11.x (?)
148150 $wgHooks['LangugeGetSpecialPageAliases'][] = 'SpecialOpenID::LocalizedPageName'; # Add any aliases for the special page.
149151 }
@@ -151,15 +153,15 @@
152154
153155 function OpenIDArticleViewHeader(&$article, &$outputDone, &$pcache ) {
154156 global $wgOut;
155 -
 157+
156158 $nt = $article->getTitle();
157 -
 159+
158160 // If the page being viewed is a user page,
159161 // generate the openid.server META tag and output
160162 // the X-XRDS-Location. See the OpenIDXRDS
161163 // special page for the XRDS output / generation
162164 // logic.
163 -
 165+
164166 if ($nt &&
165167 ($nt->getNamespace() == NS_USER) &&
166168 strpos($nt->getText(), '/') === false)
@@ -169,12 +171,12 @@
170172 $openid = SpecialOpenID::getUserUrl($user);
171173 if (isset($openid) && strlen($openid) != 0) {
172174 global $wgOpenIDShowUrlOnUserPage;
173 -
 175+
174176 if ($wgOpenIDShowUrlOnUserPage == 'always' ||
175177 ($wgOpenIDShowUrlOnUserPage == 'user' && !$user->getOption('hideopenid')))
176178 {
177179 global $wgOpenIDLoginLogoUrl;
178 -
 180+
179181 $url = SpecialOpenID::OpenIDToUrl($openid);
180182 $disp = htmlspecialchars($openid);
181183 $wgOut->setSubtitle("<span class='subpages'>" .
@@ -194,36 +196,36 @@
195197 }
196198 }
197199 }
198 -
 200+
199201 return TRUE;
200202 }
201203
202204 function OpenIDPersonalUrls(&$personal_urls, &$title) {
203205 global $wgHideOpenIDLoginLink, $wgUser, $wgLang, $wgOut;
204 -
 206+
205207 if (!$wgHideOpenIDLoginLink && $wgUser->getID() == 0) {
206208 $wgOut->addHeadItem('openidloginstyle', OpenIDLoginStyle());
207209 $sk = $wgUser->getSkin();
208210 $returnto = ($title->getPrefixedUrl() == $wgLang->specialPage( 'Userlogout' )) ?
209211 '' : ('returnto=' . $title->getPrefixedURL());
210 -
 212+
211213 $personal_urls['openidlogin'] = array(
212214 'text' => wfMsg('openidlogin'),
213215 'href' => $sk->makeSpecialUrl( 'OpenIDLogin', $returnto ),
214216 'active' => $title->isSpecial( 'OpenIDLogin' )
215217 );
216218 }
217 -
 219+
218220 return true;
219221 }
220222
221223 function OpenIDUserToggles(&$extraToggles) {
222224 global $wgOpenIDShowUrlOnUserPage;
223 -
 225+
224226 if ($wgOpenIDShowUrlOnUserPage == 'user') {
225227 $extraToggles[] = 'hideopenid';
226228 }
227 -
 229+
228230 return true;
229231 }
230232
Index: trunk/extensions/OpenID/openid_table.sql
@@ -5,4 +5,3 @@
66 PRIMARY KEY uoi_openid (uoi_openid),
77 UNIQUE INDEX uoi_user (uoi_user)
88 ) TYPE=InnoDB;
9 -
Property changes on: trunk/extensions/OpenID/OpenID.php
___________________________________________________________________
Added: svn:eol-style
109 + native
Index: trunk/extensions/OpenID/SpecialOpenIDServer.body.php
@@ -48,13 +48,14 @@
4949
5050 function SpecialOpenIDServer() {
5151 SpecialPage::SpecialPage("OpenIDServer", '', false);
52 - self::loadMessages();
5352 }
5453
5554 function execute($par) {
5655
5756 global $wgOut;
5857
 58+ wfLoadExtensionMessages( 'OpenID' );
 59+
5960 $this->setHeaders();
6061
6162 $server =& $this->getServer();
@@ -735,4 +736,3 @@
736737 return $this->fullURL('OpenIDServer');
737738 }
738739 }
739 -
Index: trunk/extensions/OpenID/optionToTable.php
@@ -47,4 +47,3 @@
4848 OpenIDSetUserUrl($user, $user->getOption('openid_url'));
4949 }
5050 $dbr->freeResult($res);
51 -
Index: trunk/extensions/OpenID/SpecialOpenIDLogin.body.php
@@ -28,17 +28,18 @@
2929 require_once("Auth/OpenID/Consumer.php");
3030
3131 class SpecialOpenIDLogin extends SpecialOpenID {
32 -
 32+
3333 function SpecialOpenIDLogin() {
3434 SpecialPage::SpecialPage("OpenIDLogin");
35 - self::loadMessages();
3635 }
3736
3837 function execute($par) {
3938 global $wgRequest, $wgUser, $wgOut;
4039
 40+ wfLoadExtensionMessages( 'OpenID' );
 41+
4142 $this->setHeaders();
42 -
 43+
4344 if ($wgUser->getID() != 0) {
4445 $this->alreadyLoggedIn();
4546 return;
@@ -47,9 +48,9 @@
4849 if ($wgRequest->getText('returnto')) {
4950 $this->setReturnTo($wgRequest->getText('returnto'));
5051 }
51 -
 52+
5253 $openid_url = $wgRequest->getText('openid_url');
53 -
 54+
5455 if (isset($openid_url) && strlen($openid_url) > 0) {
5556 $this->login($openid_url);
5657 } else {
@@ -167,10 +168,8 @@
168169 function returnTo() {
169170 return $_SESSION['openid_consumer_returnto'];
170171 }
171 -
 172+
172173 function setReturnTo($returnto) {
173174 $_SESSION['openid_consumer_returnto'] = $returnto;
174175 }
175176 }
176 -
177 -?>
Index: trunk/extensions/OpenID/README
@@ -148,7 +148,7 @@
149149 * The extension has been converted to use a clumsy and perverse
150150 OOP-like structure, with one class per special page. Most function
151151 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.
153153 * The extension has been converted to use the autoloading features
154154 of MediaWiki, which means that you need to require() the files
155155 directly if you really want to use their code. Or you might get
@@ -281,14 +281,14 @@
282282 link, like in your skin. Note that it will *not* prevent login if
283283 the user navigates to Special:OpenIDLogin directly; it's simply
284284 cosmetic. This is mostly a backwards-compatibility option.
285 -
 285+
286286 * $wgOpenIDLoginLogoUrl -- Url of the OpenID login logo. Defaults to
287287 'http://www.openid.net/login-bg.gif', but you may want to move it to
288288 a local URL, or an URL on a CDN, if that kind of thing floats your
289289 boat.
290290
291291 * $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'
293293 (lets the user decide). Default is 'user'.
294294
295295 == Skins ==
@@ -331,4 +331,3 @@
332332 control panel
333333 * Auto-login if you've logged in before with an OpenID, and are logged
334334 into that account now
335 -

Status & tagging log