r49623 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49622‎ | r49623 | r49624 >
Date:08:39, 18 April 2009
Author:siebrand
Status:deferred
Tags:
Comment:
update indentation, remove trailing whitespace, stylize.php
Modified paths:
  • /trunk/extensions/OpenID/OpenID.hooks.php (modified) (history)
  • /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/OpenIDProvider.body.php (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/TODO (modified) (history)
  • /trunk/extensions/OpenID/openid_table.sql (modified) (history)
  • /trunk/extensions/OpenID/optionToTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/OpenID.i18n.php
@@ -469,7 +469,7 @@
470470 'openiderror' => 'Greška pri provjeri',
471471 'openiderrortext' => 'Desila se greška pri provjeri OpenID URL adrese.',
472472 'openidconfigerror' => 'Greška OpenID postavki',
473 - 'openidconfigerrortext' => 'OpenID konfiguracija spremanja za ovaj wiki je nevaljana.
 473+ 'openidconfigerrortext' => 'OpenID konfiguracija spremanja za ovaj wiki je nevaljana.
474474 Molimo konsultujte se sa [[Special:ListUsers/sysop|administratorom]].',
475475 'openidpermission' => 'Greška kod OpenID dopuštenja',
476476 'openidpermissiontext' => 'OpenID koji ste naveli nije dopušteno da se prijavi na ovaj server.',
@@ -2636,10 +2636,10 @@
26372637 'openidclientonlytext' => 'Nie można korzystać z kont tej wiki jako OpenID w innych witrynach.',
26382638 'openidloginlabel' => 'Adres URL OpenID',
26392639 'openidlogininstructions' => '{{SITENAME}} korzysta ze standardu [http://openid.net/ OpenID] dla zapewnienia jednolitego uwierzytelnienia pomiędzy różnymi witrynami w sieci Web.
2640 -OpenID pozwala na zalogowanie się do wielu różnych witryn sieci Web bez użycia osobnego hasła dla każdej witryny.
 2640+OpenID pozwala na zalogowanie się do wielu różnych witryn sieci Web bez użycia osobnego hasła dla każdej witryny.
26412641 (Zobacz [http://pl.wikipedia.org/wiki/OpenID artykuł o OpenID w Wikipedii] jeśli chcesz uzyskać więcej informacji.)
26422642
2643 -Jeśli masz już konto w {{GRAMMAR:MS.lp|{{SITENAME}}}}, możesz [[Specjalna:Userlogin|zalogować się]] jak zwykle używając nazwy użytkownika i hasła.
 2643+Jeśli masz już konto w {{GRAMMAR:MS.lp|{{SITENAME}}}}, możesz [[Specjalna:Userlogin|zalogować się]] jak zwykle używając nazwy użytkownika i hasła.
26442644 Jeśli chcesz w przyszłości używać OpenID do logowania się, możesz [[Special:OpenIDConvert|przełączyć konto na korzystanie z OpenID]] po normalnym zalogowaniu się.
26452645
26462646 Jest wielu [http://openid.net/get/ operatorów usługi OpenID] i możesz mieć już konto przełączone na korzystanie z OpenID innego usługodawcy.',
@@ -3260,7 +3260,7 @@
32613261 'openidclientonlytext' => 'Du kan inte använda konton från denna wikin som OpenID på en annan sida.',
32623262 'openidloginlabel' => 'OpenID-adress',
32633263 'openidlogininstructions' => '{{SITENAME}} stödjer [http://openid.net/ OpenID]-standarden för enhetlig inlogging på många webbsidor.
3264 -OpenID låter dig logga in på många webbsidor utan att använda olika lösenord för varje.
 3264+OpenID låter dig logga in på många webbsidor utan att använda olika lösenord för varje.
32653265 (Se [http://en.wikipedia.org/wiki/OpenID Wikipedia-artikeln om OpenID] för mer information.)
32663266
32673267 Om du redan har ett konto på {{SITENAME}}, kan du [[Special:UserLogin|logga in]] som vanligt med ditt användarnamn och lösenord.
Index: trunk/extensions/OpenID/openid_table.sql
@@ -1,7 +1,7 @@
22 CREATE TABLE /*$wgDBprefix*/user_openid (
33 uoi_openid varchar(255) NOT NULL,
44 uoi_user int(5) unsigned NOT NULL,
5 -
 5+
66 PRIMARY KEY uoi_openid (uoi_openid),
77 UNIQUE INDEX uoi_user (uoi_user)
88 ) TYPE=InnoDB;
Index: trunk/extensions/OpenID/OpenID.hooks.php
@@ -19,7 +19,7 @@
2020 }
2121
2222 foreach ( $addList as $sp ) {
23 - $list['OpenID'.$sp] = 'SpecialOpenID' . $sp;
 23+ $list['OpenID' . $sp] = 'SpecialOpenID' . $sp;
2424 }
2525
2626 return true;
@@ -39,7 +39,7 @@
4040
4141 if ( $nt && $nt->getNamespace() == NS_USER && strpos( $nt->getText(), '/' ) === false ) {
4242 $user = User::newFromName( $nt->getText() );
43 - if ($user && $user->getID() != 0) {
 43+ if ( $user && $user->getID() != 0 ) {
4444 $openid = SpecialOpenID::getUserUrl( $user );
4545 if ( isset( $openid ) && strlen( $openid ) != 0 ) {
4646 global $wgOpenIDShowUrlOnUserPage;
@@ -51,10 +51,10 @@
5252
5353 $url = SpecialOpenID::OpenIDToUrl( $openid );
5454 $disp = htmlspecialchars( $openid );
55 - $wgOut->setSubtitle("<span class='subpages'>" .
 55+ $wgOut->setSubtitle( "<span class='subpages'>" .
5656 "<img src='$wgOpenIDLoginLogoUrl' alt='OpenID' />" .
5757 "<a href='$url'>$disp</a>" .
58 - "</span>");
 58+ "</span>" );
5959 }
6060 } else {
6161 # Add OpenID data iif its allowed
@@ -75,7 +75,7 @@
7676 return true;
7777 }
7878
79 - public static function onPersonalUrls(&$personal_urls, &$title) {
 79+ public static function onPersonalUrls( &$personal_urls, &$title ) {
8080 global $wgHideOpenIDLoginLink, $wgUser, $wgLang, $wgOut, $wgOpenIDOnly;
8181
8282 if ( !$wgHideOpenIDLoginLink && $wgUser->getID() == 0 ) {
@@ -83,7 +83,7 @@
8484 $wgOut->addHeadItem( 'openidloginstyle', self::loginStyle() );
8585 $sk = $wgUser->getSkin();
8686 $returnto = $title->isSpecial( 'Userlogout' ) ?
87 - '' : ('returnto=' . $title->getPrefixedURL() );
 87+ '' : ( 'returnto=' . $title->getPrefixedURL() );
8888
8989 $personal_urls['openidlogin'] = array(
9090 'text' => wfMsg( 'openidlogin' ),
@@ -108,10 +108,10 @@
109109 private static $oidPrefs = array( 'hide', 'update-userinfo-on-login' );
110110
111111 public static function onInitPreferencesForm( $prefs, $request ) {
112 - foreach (self::$oidPrefs as $oidPref)
 112+ foreach ( self::$oidPrefs as $oidPref )
113113 {
114 - $prefs->mToggles['openid-'.$oidPref]
115 - = $request->getCheck( "wpOpOpenID-".$oidPref ) ? 1 : 0;
 114+ $prefs->mToggles['openid-' . $oidPref]
 115+ = $request->getCheck( "wpOpOpenID-" . $oidPref ) ? 1 : 0;
116116 }
117117
118118 return true;
@@ -122,16 +122,16 @@
123123
124124 $out->addHTML( "\n<fieldset>\n<legend>" . wfMsgHtml( 'openid-prefs' ) . "</legend>\n" );
125125
126 - $out->addWikiText( wfMsg( 'openid-prefstext') );
 126+ $out->addWikiText( wfMsg( 'openid-prefstext' ) );
127127
128 - foreach (self::$oidPrefs as $oidPref)
 128+ foreach ( self::$oidPrefs as $oidPref )
129129 {
130 - $out->addHTML( '<div class="toggle"><input type="checkbox" value="1" '.
131 - 'id="openid-'.$oidPref.'" name="wpOpOpenID-'.$oidPref.'"'.
132 - ($prefs->mToggles['openid-'.$oidPref] == 1 ? ' checked="checked"' : '').
 130+ $out->addHTML( '<div class="toggle"><input type="checkbox" value="1" ' .
 131+ 'id="openid-' . $oidPref . '" name="wpOpOpenID-' . $oidPref . '"' .
 132+ ( $prefs->mToggles['openid-' . $oidPref] == 1 ? ' checked="checked"' : '' ) .
133133 '/> ' .
134 - '<span class="toggletext">'.
135 - '<label for="openid-'.$oidPref.'">'.wfMsg( 'openid-pref-'.$oidPref ).'</label>'.
 134+ '<span class="toggletext">' .
 135+ '<label for="openid-' . $oidPref . '">' . wfMsg( 'openid-pref-' . $oidPref ) . '</label>' .
136136 "</span></div>\n" );
137137 }
138138
@@ -140,12 +140,12 @@
141141 return true;
142142 }
143143
144 - public static function onSavePreferences($prefs, $user, &$message, $old)
 144+ public static function onSavePreferences( $prefs, $user, &$message, $old )
145145 {
146 - foreach (self::$oidPrefs as $oidPref)
 146+ foreach ( self::$oidPrefs as $oidPref )
147147 {
148 - $user->setOption('openid-'.$oidPref, $prefs->mToggles['openid-'.$oidPref]);
149 - wfDebugLog('OpenID', 'Setting user preferences: ' . print_r($user, true) );
 148+ $user->setOption( 'openid-' . $oidPref, $prefs->mToggles['openid-' . $oidPref] );
 149+ wfDebugLog( 'OpenID', 'Setting user preferences: ' . print_r( $user, true ) );
150150 }
151151
152152 $user->saveSettings();
@@ -156,7 +156,7 @@
157157 public static function onResetPreferences( $prefs, $user )
158158 {
159159 foreach ( self::$oidPrefs as $oidPref ) {
160 - $prefs->mToggles['openid-'.$oidPref] = $user->getOption( 'openid-'.$oidPref );
 160+ $prefs->mToggles['openid-' . $oidPref] = $user->getOption( 'openid-' . $oidPref );
161161 }
162162
163163 return true;
@@ -167,9 +167,9 @@
168168
169169 $base = dirname( __FILE__ );
170170
171 - if( $wgDBtype == 'mysql' ) {
 171+ if ( $wgDBtype == 'mysql' ) {
172172 $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.sql" );
173 - } else if( $wgDBtype == 'postgres' ) {
 173+ } else if ( $wgDBtype == 'postgres' ) {
174174 $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.pg.sql" );
175175 }
176176
Index: trunk/extensions/OpenID/SpecialOpenIDServer.body.php
@@ -22,11 +22,11 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI'))
27 - exit(1);
 26+if ( !defined( 'MEDIAWIKI' ) )
 27+ exit( 1 );
2828
29 -require_once("Auth/OpenID/Server.php");
30 -require_once("Auth/OpenID/Consumer.php");
 29+require_once( "Auth/OpenID/Server.php" );
 30+require_once( "Auth/OpenID/Consumer.php" );
3131
3232 # Special page for the server side of OpenID
3333 # It has three major flavors:
@@ -47,10 +47,10 @@
4848 class SpecialOpenIDServer extends SpecialOpenID {
4949
5050 function SpecialOpenIDServer() {
51 - SpecialPage::SpecialPage("OpenIDServer", '', false);
 51+ SpecialPage::SpecialPage( "OpenIDServer", '', false );
5252 }
5353
54 - function execute($par) {
 54+ function execute( $par ) {
5555
5656 global $wgOut, $wgOpenIDClientOnly;
5757
@@ -61,89 +61,89 @@
6262 # No server functionality if this site is only a client
6363 # Note: special page is un-registered if this flag is set,
6464 # so it'd be unusual to get here.
65 -
66 - if ($wgOpenIDClientOnly) {
67 - $wgOut->showErrorPage('openiderror', 'openidclientonlytext');
 65+
 66+ if ( $wgOpenIDClientOnly ) {
 67+ $wgOut->showErrorPage( 'openiderror', 'openidclientonlytext' );
6868 return;
6969 }
70 -
 70+
7171 $server =& $this->getServer();
7272
73 - switch ($par) {
 73+ switch ( $par ) {
7474 case 'Login':
75 - list($request, $sreg) = $this->FetchValues();
76 - $result = $this->serverLogin($request);
77 - if ($result) {
78 - if (is_string($result)) {
79 - $this->LoginForm($request, $result);
 75+ list( $request, $sreg ) = $this->FetchValues();
 76+ $result = $this->serverLogin( $request );
 77+ if ( $result ) {
 78+ if ( is_string( $result ) ) {
 79+ $this->LoginForm( $request, $result );
8080 return;
8181 } else {
82 - $this->Response($server, $result);
 82+ $this->Response( $server, $result );
8383 return;
8484 }
8585 }
8686 break;
87 - case 'Trust':
88 - list($request, $sreg) = $this->FetchValues();
89 - $result = $this->Trust($request, $sreg);
90 - if ($result) {
91 - if (is_string($result)) {
92 - $this->TrustForm($request, $sreg, $result);
 87+ case 'Trust':
 88+ list( $request, $sreg ) = $this->FetchValues();
 89+ $result = $this->Trust( $request, $sreg );
 90+ if ( $result ) {
 91+ if ( is_string( $result ) ) {
 92+ $this->TrustForm( $request, $sreg, $result );
9393 return;
9494 } else {
95 - $this->Response($server, $result);
 95+ $this->Response( $server, $result );
9696 return;
9797 }
9898 }
9999 break;
100 - default:
101 - if (strlen($par)) {
102 - wfDebug("OpenID: aborting in user validation because the parameter was empty\n");
103 - $wgOut->showErrorPage('openiderror', 'openiderrortext');
 100+ default:
 101+ if ( strlen( $par ) ) {
 102+ wfDebug( "OpenID: aborting in user validation because the parameter was empty\n" );
 103+ $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
104104 return;
105105 } else {
106106 $method = $_SERVER['REQUEST_METHOD'];
107107 $query = null;
108 - if ($method == 'GET') {
 108+ if ( $method == 'GET' ) {
109109 $query = $_GET;
110110 } else {
111111 $query = $_POST;
112112 }
113113
114114 $request = $server->decodeRequest();
115 - $sreg = $this->SregFromQuery($query);
 115+ $sreg = $this->SregFromQuery( $query );
116116 $response = NULL;
117117 break;
118118 }
119119 }
120120
121 - if (!isset($request)) {
122 - wfDebug("OpenID: aborting in user validation because the request was missing\n");
123 - $wgOut->showErrorPage('openiderror', 'openiderrortext');
 121+ if ( !isset( $request ) ) {
 122+ wfDebug( "OpenID: aborting in user validation because the request was missing\n" );
 123+ $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
124124 return;
125125 }
126126
127127 global $wgUser;
128128
129 - switch ($request->mode) {
 129+ switch ( $request->mode ) {
130130 case "checkid_setup":
131 - $response = $this->Check($server, $request, $sreg, false);
 131+ $response = $this->Check( $server, $request, $sreg, false );
132132 break;
133133 case "checkid_immediate":
134 - $response = $this->Check($server, $request, $sreg, true);
 134+ $response = $this->Check( $server, $request, $sreg, true );
135135 break;
136136 default:
137137 # For all the other parts, just let the libs do it
138 - $response =& $server->handleRequest($request);
 138+ $response =& $server->handleRequest( $request );
139139 }
140140
141141 # OpenIDServerCheck returns NULL if some output (like a form)
142142 # has been done
143143
144 - if (isset($response)) {
 144+ if ( isset( $response ) ) {
145145 # We're done; clear values
146146 $this->ClearValues();
147 - $this->Response($server, $response);
 147+ $this->Response( $server, $response );
148148 }
149149 }
150150
@@ -151,8 +151,8 @@
152152 # for some requests
153153
154154 function Url() {
155 - $nt = Title::makeTitleSafe(NS_SPECIAL, 'OpenIDServer');
156 - if (isset($nt)) {
 155+ $nt = Title::makeTitleSafe( NS_SPECIAL, 'OpenIDServer' );
 156+ if ( isset( $nt ) ) {
157157 return $nt->getFullURL();
158158 } else {
159159 return NULL;
@@ -165,97 +165,97 @@
166166 global $wgOpenIDServerStorePath,
167167 $wgOpenIDServerStoreType;
168168
169 - $store = $this->getOpenIDStore($wgOpenIDServerStoreType,
 169+ $store = $this->getOpenIDStore( $wgOpenIDServerStoreType,
170170 'server',
171 - array('path' => $wgOpenIDServerStorePath));
 171+ array( 'path' => $wgOpenIDServerStorePath ) );
172172
173 - return new Auth_OpenID_Server($store, $this->serverUrl());
 173+ return new Auth_OpenID_Server( $store, $this->serverUrl() );
174174 }
175175
176176 # Checks a validation request. $imm means don't run any UI.
177177 # Fairly meticulous and step-by step, and uses assertions
178178 # to point out assumptions at each step.
179179 #
180 - # XXX: this should probably be broken up into multiple functions for
 180+ # FIXME: this should probably be broken up into multiple functions for
181181 # clarity.
182182
183 - function Check($server, $request, $sreg, $imm = true) {
 183+ function Check( $server, $request, $sreg, $imm = true ) {
184184
185185 global $wgUser, $wgOut;
186186
187 - assert(isset($wgUser) && isset($wgOut));
188 - assert(isset($server));
189 - assert(isset($request));
190 - assert(isset($sreg));
191 - assert(isset($imm) && is_bool($imm));
 187+ assert( isset( $wgUser ) && isset( $wgOut ) );
 188+ assert( isset( $server ) );
 189+ assert( isset( $request ) );
 190+ assert( isset( $sreg ) );
 191+ assert( isset( $imm ) && is_bool( $imm ) );
192192
193193 # Is the passed identity URL a user page?
194194
195195 $url = $request->identity;
196196
197 - assert(isset($url) && strlen($url) > 0);
 197+ assert( isset( $url ) && strlen( $url ) > 0 );
198198
199 - $name = $this->UrlToUserName($url);
 199+ $name = $this->UrlToUserName( $url );
200200
201 - if (!isset($name) || strlen($name) == 0) {
202 - wfDebug("OpenID: '$url' not a user page.\n");
203 - return $request->answer(false, $this->serverUrl());
 201+ if ( !isset( $name ) || strlen( $name ) == 0 ) {
 202+ wfDebug( "OpenID: '$url' not a user page.\n" );
 203+ return $request->answer( false, $this->serverUrl() );
204204 }
205205
206 - assert(isset($name) && strlen($name) > 0);
 206+ assert( isset( $name ) && strlen( $name ) > 0 );
207207
208208 # Is there a logged in user?
209209
210 - if ($wgUser->getId() == 0) {
211 - wfDebug("OpenID: User not logged in.\n");
212 - if ($imm) {
213 - return $request->answer(false, $this->serverUrl());
 210+ if ( $wgUser->getId() == 0 ) {
 211+ wfDebug( "OpenID: User not logged in.\n" );
 212+ if ( $imm ) {
 213+ return $request->answer( false, $this->serverUrl() );
214214 } else {
215215 # Bank these for later
216 - $this->SaveValues($request, $sreg);
217 - $this->LoginForm($request);
 216+ $this->SaveValues( $request, $sreg );
 217+ $this->LoginForm( $request );
218218 return NULL;
219219 }
220220 }
221221
222 - assert($wgUser->getId() != 0);
 222+ assert( $wgUser->getId() != 0 );
223223
224224 # Is the user page for the logged-in user?
225225
226 - $user = User::newFromName($name);
 226+ $user = User::newFromName( $name );
227227
228 - if (!isset($user) ||
229 - $user->getId() != $wgUser->getId()) {
230 - wfDebug("OpenID: User from url not logged in user.\n");
231 - return $request->answer(false, $this->serverUrl());
 228+ if ( !isset( $user ) ||
 229+ $user->getId() != $wgUser->getId() ) {
 230+ wfDebug( "OpenID: User from url not logged in user.\n" );
 231+ return $request->answer( false, $this->serverUrl() );
232232 }
233233
234 - assert(isset($user) && $user->getId() == $wgUser->getId() && $user->getId() != 0);
 234+ assert( isset( $user ) && $user->getId() == $wgUser->getId() && $user->getId() != 0 );
235235
236236 # Is the user an OpenID user?
237237
238 - $openid = $this->getUserUrl($user);
 238+ $openid = $this->getUserUrl( $user );
239239
240 - if (isset($openid) && strlen($openid) > 0) {
241 - wfDebug("OpenID: Not one of our users; logs in with OpenID.\n");
242 - return $request->answer(false, $this->serverUrl());
 240+ if ( isset( $openid ) && strlen( $openid ) > 0 ) {
 241+ wfDebug( "OpenID: Not one of our users; logs in with OpenID.\n" );
 242+ return $request->answer( false, $this->serverUrl() );
243243 }
244244
245 - assert(is_array($sreg));
 245+ assert( is_array( $sreg ) );
246246
247247 # Does the request require sreg fields that the user has not specified?
248248
249 - if (array_key_exists('required', $sreg)) {
 249+ if ( array_key_exists( 'required', $sreg ) ) {
250250 $notFound = false;
251 - foreach ($sreg['required'] as $reqfield) {
252 - if (is_null($this->GetUserField($user, $reqfield))) {
 251+ foreach ( $sreg['required'] as $reqfield ) {
 252+ if ( is_null( $this->GetUserField( $user, $reqfield ) ) ) {
253253 $notFound = true;
254254 break;
255255 }
256256 }
257 - if ($notFound) {
258 - wfDebug("OpenID: Consumer demands info we don't have.\n");
259 - return $request->answer(false, $this->serverUrl());
 257+ if ( $notFound ) {
 258+ wfDebug( "OpenID: Consumer demands info we don't have.\n" );
 259+ return $request->answer( false, $this->serverUrl() );
260260 }
261261 }
262262
@@ -263,71 +263,71 @@
264264
265265 $trust_root = $request->trust_root;
266266
267 - assert(isset($trust_root) && is_string($trust_root) && strlen($trust_root) > 0);
 267+ assert( isset( $trust_root ) && is_string( $trust_root ) && strlen( $trust_root ) > 0 );
268268
269 - $trust = $this->GetUserTrust($user, $trust_root);
 269+ $trust = $this->GetUserTrust( $user, $trust_root );
270270
271271 # Is there a trust record?
272272
273 - if (is_null($trust)) {
274 - wfDebug("OpenID: No trust record.\n");
275 - if ($imm) {
276 - return $request->answer(false, $this->serverUrl());
 273+ if ( is_null( $trust ) ) {
 274+ wfDebug( "OpenID: No trust record.\n" );
 275+ if ( $imm ) {
 276+ return $request->answer( false, $this->serverUrl() );
277277 } else {
278278 # Bank these for later
279 - $this->SaveValues($request, $sreg);
280 - $this->TrustForm($request, $sreg);
 279+ $this->SaveValues( $request, $sreg );
 280+ $this->TrustForm( $request, $sreg );
281281 return NULL;
282282 }
283283 }
284284
285 - assert(!is_null($trust));
 285+ assert( !is_null( $trust ) );
286286
287287 # Is the trust record _not_ to allow trust?
288288 # NB: exactly equal
289289
290 - if ($trust === false) {
291 - wfDebug("OpenID: User specified not to allow trust.\n");
292 - return $request->answer(false, $this->serverUrl());
 290+ if ( $trust === false ) {
 291+ wfDebug( "OpenID: User specified not to allow trust.\n" );
 292+ return $request->answer( false, $this->serverUrl() );
293293 }
294294
295 - assert(isset($trust) && is_array($trust));
 295+ assert( isset( $trust ) && is_array( $trust ) );
296296
297297 # Does the request require sreg fields that the user has
298298 # not allowed us to pass, or has not specified?
299299
300 - if (array_key_exists('required', $sreg)) {
 300+ if ( array_key_exists( 'required', $sreg ) ) {
301301 $notFound = false;
302 - foreach ($sreg['required'] as $reqfield) {
303 - if (!in_array($reqfield, $trust) ||
304 - is_null($this->GetUserField($user, $reqfield))) {
 302+ foreach ( $sreg['required'] as $reqfield ) {
 303+ if ( !in_array( $reqfield, $trust ) ||
 304+ is_null( $this->GetUserField( $user, $reqfield ) ) ) {
305305 $notFound = true;
306306 break;
307307 }
308308 }
309 - if ($notFound) {
310 - wfDebug("OpenID: Consumer demands info user doesn't want shared.\n");
311 - return $request->answer(false, $this->serverUrl());
 309+ if ( $notFound ) {
 310+ wfDebug( "OpenID: Consumer demands info user doesn't want shared.\n" );
 311+ return $request->answer( false, $this->serverUrl() );
312312 }
313313 }
314314
315 - # assert(all required sreg fields are in $trust)
 315+ # assert(all required sreg fields are in $trust)
316316
317 - # XXX: run a hook here to check
 317+ # FIXME: run a hook here to check
318318
319319 # SUCCESS
320320
321 - $response_fields = array_intersect(array_unique(array_merge($sreg['required'], $sreg['optional'])),
322 - $trust);
 321+ $response_fields = array_intersect( array_unique( array_merge( $sreg['required'], $sreg['optional'] ) ),
 322+ $trust );
323323
324 - $response = $request->answer(true);
 324+ $response = $request->answer( true );
325325
326 - assert(isset($response));
 326+ assert( isset( $response ) );
327327
328 - foreach ($response_fields as $field) {
329 - $value = $this->GetUserField($user, $field);
330 - if (!is_null($value)) {
331 - $response->addField('sreg', $field, $value);
 328+ foreach ( $response_fields as $field ) {
 329+ $value = $this->GetUserField( $user, $field );
 330+ if ( !is_null( $value ) ) {
 331+ $response->addField( 'sreg', $field, $value );
332332 }
333333 }
334334
@@ -340,53 +340,53 @@
341341 # * false -> stored trust preference is not to trust
342342 # * array -> possibly empty array of allowed profile fields; trust is OK
343343
344 - function GetUserTrust($user, $trust_root) {
345 - static $allFields = array('nickname', 'fullname', 'email', 'language');
 344+ function GetUserTrust( $user, $trust_root ) {
 345+ static $allFields = array( 'nickname', 'fullname', 'email', 'language' );
346346 global $wgOpenIDServerForceAllowTrust;
347347
348 - foreach ($wgOpenIDServerForceAllowTrust as $force) {
349 - if (preg_match($force, $trust_root)) {
 348+ foreach ( $wgOpenIDServerForceAllowTrust as $force ) {
 349+ if ( preg_match( $force, $trust_root ) ) {
350350 return $allFields;
351351 }
352352 }
353353
354 - $trust_array = $this->GetUserTrustArray($user);
 354+ $trust_array = $this->GetUserTrustArray( $user );
355355
356 - if (array_key_exists($trust_root, $trust_array)) {
 356+ if ( array_key_exists( $trust_root, $trust_array ) ) {
357357 return $trust_array[$trust_root];
358358 } else {
359359 return null; # Unspecified trust
360360 }
361361 }
362362
363 - function SetUserTrust(&$user, $trust_root, $value) {
 363+ function SetUserTrust( &$user, $trust_root, $value ) {
364364
365 - $trust_array = $this->GetUserTrustArray($user);
 365+ $trust_array = $this->GetUserTrustArray( $user );
366366
367 - if (is_null($value)) {
368 - if (array_key_exists($trust_root, $trust_array)) {
369 - unset($trust_array[$trust_root]);
 367+ if ( is_null( $value ) ) {
 368+ if ( array_key_exists( $trust_root, $trust_array ) ) {
 369+ unset( $trust_array[$trust_root] );
370370 }
371371 } else {
372372 $trust_array[$trust_root] = $value;
373373 }
374374
375 - $this->SetUserTrustArray($user, $trust_array);
 375+ $this->SetUserTrustArray( $user, $trust_array );
376376 }
377377
378 - function GetUserTrustArray($user) {
 378+ function GetUserTrustArray( $user ) {
379379 $trust_array = array();
380 - $trust_str = $user->getOption('openid_trust');
381 - if (strlen($trust_str) > 0) {
382 - $trust_records = explode("\x1E", $trust_str);
383 - foreach ($trust_records as $record) {
384 - $fields = explode("\x1F", $record);
385 - $trust_root = array_shift($fields);
386 - if (count($fields) == 1 && strcmp($fields[0], 'no') == 0) {
 380+ $trust_str = $user->getOption( 'openid_trust' );
 381+ if ( strlen( $trust_str ) > 0 ) {
 382+ $trust_records = explode( "\x1E", $trust_str );
 383+ foreach ( $trust_records as $record ) {
 384+ $fields = explode( "\x1F", $record );
 385+ $trust_root = array_shift( $fields );
 386+ if ( count( $fields ) == 1 && strcmp( $fields[0], 'no' ) == 0 ) {
387387 $trust_array[$trust_root] = false;
388388 } else {
389 - $fields = array_map('trim', $fields);
390 - $fields = array_filter($fields, array($this, 'ValidField'));
 389+ $fields = array_map( 'trim', $fields );
 390+ $fields = array_filter( $fields, array( $this, 'ValidField' ) );
391391 $trust_array[$trust_root] = $fields;
392392 }
393393 }
@@ -394,62 +394,62 @@
395395 return $trust_array;
396396 }
397397
398 - function SetUserTrustArray(&$user, $arr) {
 398+ function SetUserTrustArray( &$user, $arr ) {
399399 $trust_records = array();
400 - foreach ($arr as $root => $value) {
401 - if ($value === false) {
402 - $record = implode("\x1F", array($root, 'no'));
403 - } else if (is_array($value)) {
404 - if (count($value) == 0) {
 400+ foreach ( $arr as $root => $value ) {
 401+ if ( $value === false ) {
 402+ $record = implode( "\x1F", array( $root, 'no' ) );
 403+ } else if ( is_array( $value ) ) {
 404+ if ( count( $value ) == 0 ) {
405405 $record = $root;
406406 } else {
407 - $value = array_map('trim', $value);
408 - $value = array_filter($value, array($this, 'ValidField'));
409 - $record = implode("\x1F", array_merge(array($root), $value));
 407+ $value = array_map( 'trim', $value );
 408+ $value = array_filter( $value, array( $this, 'ValidField' ) );
 409+ $record = implode( "\x1F", array_merge( array( $root ), $value ) );
410410 }
411411 } else {
412412 continue;
413413 }
414414 $trust_records[] = $record;
415415 }
416 - $trust_str = implode("\x1E", $trust_records);
417 - $user->setOption('openid_trust', $trust_str);
 416+ $trust_str = implode( "\x1E", $trust_records );
 417+ $user->setOption( 'openid_trust', $trust_str );
418418 }
419419
420 - function ValidField($name) {
421 - # XXX: eventually add timezone
422 - static $fields = array('nickname', 'email', 'fullname', 'language');
423 - return in_array($name, $fields);
 420+ function ValidField( $name ) {
 421+ # FIXME: eventually add timezone
 422+ static $fields = array( 'nickname', 'email', 'fullname', 'language' );
 423+ return in_array( $name, $fields );
424424 }
425425
426 - function SregFromQuery($query) {
427 - $sreg = array('required' => array(), 'optional' => array(),
428 - 'policy_url' => NULL);
429 - if (array_key_exists('openid.sreg.required', $query)) {
430 - $sreg['required'] = explode(',', $query['openid.sreg.required']);
 426+ function SregFromQuery( $query ) {
 427+ $sreg = array( 'required' => array(), 'optional' => array(),
 428+ 'policy_url' => NULL );
 429+ if ( array_key_exists( 'openid.sreg.required', $query ) ) {
 430+ $sreg['required'] = explode( ',', $query['openid.sreg.required'] );
431431 }
432 - if (array_key_exists('openid.sreg.optional', $query)) {
433 - $sreg['optional'] = explode(',', $query['openid.sreg.optional']);
 432+ if ( array_key_exists( 'openid.sreg.optional', $query ) ) {
 433+ $sreg['optional'] = explode( ',', $query['openid.sreg.optional'] );
434434 }
435 - if (array_key_exists('openid.sreg.policy_url', $query)) {
 435+ if ( array_key_exists( 'openid.sreg.policy_url', $query ) ) {
436436 $sreg['policy_url'] = $query['openid.sreg.policy_url'];
437437 }
438438 return $sreg;
439439 }
440440
441 - function SetUserField(&$user, $field, $value) {
442 - switch ($field) {
 441+ function SetUserField( &$user, $field, $value ) {
 442+ switch ( $field ) {
443443 case 'fullname':
444 - $user->setRealName($value);
 444+ $user->setRealName( $value );
445445 return true;
446446 break;
447447 case 'email':
448448 # FIXME: deal with validation
449 - $user->setEmail($value);
 449+ $user->setEmail( $value );
450450 return true;
451451 break;
452452 case 'language':
453 - $user->setOption('language', $value);
 453+ $user->setOption( 'language', $value );
454454 return true;
455455 break;
456456 default:
@@ -457,8 +457,8 @@
458458 }
459459 }
460460
461 - function GetUserField($user, $field) {
462 - switch ($field) {
 461+ function GetUserField( $user, $field ) {
 462+ switch ( $field ) {
463463 case 'nickname':
464464 return $user->getName();
465465 break;
@@ -469,29 +469,29 @@
470470 return $user->getEmail();
471471 break;
472472 case 'language':
473 - return $user->getOption('language');
 473+ return $user->getOption( 'language' );
474474 break;
475475 default:
476476 return NULL;
477477 }
478478 }
479479
480 - function Response(&$server, &$response) {
 480+ function Response( &$server, &$response ) {
481481 global $wgOut;
482482
483 - assert(!is_null($server));
484 - assert(!is_null($response));
 483+ assert( !is_null( $server ) );
 484+ assert( !is_null( $response ) );
485485
486486 $wgOut->disable();
487487
488 - $wr =& $server->encodeResponse($response);
 488+ $wr =& $server->encodeResponse( $response );
489489
490 - assert(!is_null($wr));
 490+ assert( !is_null( $wr ) );
491491
492 - header("Status: " . $wr->code);
 492+ header( "Status: " . $wr->code );
493493
494 - foreach ($wr->headers as $k => $v) {
495 - header("$k: $v");
 494+ foreach ( $wr->headers as $k => $v ) {
 495+ header( "$k: $v" );
496496 }
497497
498498 print $wr->body;
@@ -499,43 +499,43 @@
500500 return;
501501 }
502502
503 - function LoginForm($request, $msg = null) {
 503+ function LoginForm( $request, $msg = null ) {
504504
505505 global $wgOut, $wgUser;
506506
507507 $url = $request->identity;
508 - $name = $this->UrlToUserName($url);
 508+ $name = $this->UrlToUserName( $url );
509509 $trust_root = $request->trust_root;
510510
511 - $instructions = wfMsg('openidserverlogininstructions', $url, $name, $trust_root);
 511+ $instructions = wfMsg( 'openidserverlogininstructions', $url, $name, $trust_root );
512512
513 - $username = wfMsg('yourname');
514 - $password = wfMsg('yourpassword');
515 - $ok = wfMsg('ok');
516 - $cancel = wfMsg('cancel');
 513+ $username = wfMsg( 'yourname' );
 514+ $password = wfMsg( 'yourpassword' );
 515+ $ok = wfMsg( 'ok' );
 516+ $cancel = wfMsg( 'cancel' );
517517
518 - if (isset($msg)) {
519 - $wgOut->addHTML("<p class='error'>{$msg}</p>");
 518+ if ( isset( $msg ) ) {
 519+ $wgOut->addHTML( "<p class='error'>{$msg}</p>" );
520520 }
521521
522522 $sk = $wgUser->getSkin();
523523
524 - $wgOut->addHTML("<p>{$instructions}</p>" .
525 - '<form action="' . $sk->makeSpecialUrl('OpenIDServer/Login') . '" method="POST">' .
 524+ $wgOut->addHTML( "<p>{$instructions}</p>" .
 525+ '<form action="' . $sk->makeSpecialUrl( 'OpenIDServer/Login' ) . '" method="POST">' .
526526 '<table>' .
527527 "<tr><td><label for='username'>{$username}</label></td>" .
528 - ' <td><span id="username">' . htmlspecialchars($name) . '</span></td></tr>' .
 528+ ' <td><span id="username">' . htmlspecialchars( $name ) . '</span></td></tr>' .
529529 "<tr><td><label for='password'>{$password}</label></td>" .
530530 ' <td><input type="password" name="wpPassword" size="32" value="" /></td></tr>' .
531531 "<tr><td colspan='2'><input type='submit' name='wpOK' value='{$ok}' /> <input type='submit' name='wpCancel' value='{$cancel}' /></td></tr>" .
532532 '</table>' .
533 - '</form>');
 533+ '</form>' );
534534 }
535535
536 - function SaveValues($request, $sreg) {
 536+ function SaveValues( $request, $sreg ) {
537537 global $wgSessionStarted, $wgUser;
538538
539 - if (!$wgSessionStarted) {
 539+ if ( !$wgSessionStarted ) {
540540 $wgUser->SetupSession();
541541 }
542542
@@ -546,154 +546,154 @@
547547 }
548548
549549 function FetchValues() {
550 - return array($_SESSION['openid_server_request'], $_SESSION['openid_server_sreg']);
 550+ return array( $_SESSION['openid_server_request'], $_SESSION['openid_server_sreg'] );
551551 }
552552
553553 function ClearValues() {
554 - unset($_SESSION['openid_server_request']);
555 - unset($_SESSION['openid_server_sreg']);
 554+ unset( $_SESSION['openid_server_request'] );
 555+ unset( $_SESSION['openid_server_sreg'] );
556556 return true;
557557 }
558558
559 - function serverLogin($request) {
 559+ function serverLogin( $request ) {
560560
561561 global $wgRequest, $wgUser;
562562
563 - assert(isset($request));
 563+ assert( isset( $request ) );
564564
565 - assert(isset($wgRequest));
 565+ assert( isset( $wgRequest ) );
566566
567 - if ($wgRequest->getCheck('wpCancel')) {
568 - return $request->answer(false);
 567+ if ( $wgRequest->getCheck( 'wpCancel' ) ) {
 568+ return $request->answer( false );
569569 }
570570
571 - $password = $wgRequest->getText('wpPassword');
 571+ $password = $wgRequest->getText( 'wpPassword' );
572572
573 - if (!isset($password) || strlen($password) == 0) {
574 - return wfMsg('wrongpasswordempty');
 573+ if ( !isset( $password ) || strlen( $password ) == 0 ) {
 574+ return wfMsg( 'wrongpasswordempty' );
575575 }
576576
577 - assert (isset($password) && strlen($password) > 0);
 577+ assert ( isset( $password ) && strlen( $password ) > 0 );
578578
579579 $url = $request->identity;
580580
581 - assert(isset($url) && is_string($url) && strlen($url) > 0);
 581+ assert( isset( $url ) && is_string( $url ) && strlen( $url ) > 0 );
582582
583 - $name = $this->UrlToUserName($url);
 583+ $name = $this->UrlToUserName( $url );
584584
585 - assert(isset($name) && is_string($name) && strlen($name) > 0);
 585+ assert( isset( $name ) && is_string( $name ) && strlen( $name ) > 0 );
586586
587 - $user = User::newFromName($name);
 587+ $user = User::newFromName( $name );
588588
589 - assert(isset($user));
 589+ assert( isset( $user ) );
590590
591 - if (!$user->checkPassword($password)) {
592 - return wfMsg('wrongpassword');
 591+ if ( !$user->checkPassword( $password ) ) {
 592+ return wfMsg( 'wrongpassword' );
593593 } else {
594594 $id = $user->getId();
595595 $wgUser = $user;
596596 $wgUser->SetupSession();
597597 $wgUser->SetCookies();
598 - wfRunHooks('UserLoginComplete', array(&$wgUser));
 598+ wfRunHooks( 'UserLoginComplete', array( &$wgUser ) );
599599 return false;
600600 }
601601 }
602602
603 - function TrustForm($request, $sreg, $msg = NULL) {
 603+ function TrustForm( $request, $sreg, $msg = NULL ) {
604604
605605 global $wgOut, $wgUser;
606606
607607 $url = $request->identity;
608 - $name = $this->UrlToUserName($url);
 608+ $name = $this->UrlToUserName( $url );
609609 $trust_root = $request->trust_root;
610610
611 - $instructions = wfMsg('openidtrustinstructions', $trust_root);
612 - $allow = wfMsg('openidallowtrust', $trust_root);
 611+ $instructions = wfMsg( 'openidtrustinstructions', $trust_root );
 612+ $allow = wfMsg( 'openidallowtrust', $trust_root );
613613
614 - if (is_null($sreg['policy_url'])) {
615 - $policy = wfMsg('openidnopolicy');
 614+ if ( is_null( $sreg['policy_url'] ) ) {
 615+ $policy = wfMsg( 'openidnopolicy' );
616616 } else {
617 - $policy = wfMsg('openidpolicy', $sreg['policy_url']);
 617+ $policy = wfMsg( 'openidpolicy', $sreg['policy_url'] );
618618 }
619619
620 - if (isset($msg)) {
621 - $wgOut->addHTML("<p class='error'>{$msg}</p>");
 620+ if ( isset( $msg ) ) {
 621+ $wgOut->addHTML( "<p class='error'>{$msg}</p>" );
622622 }
623623
624 - $ok = wfMsg('ok');
625 - $cancel = wfMsg('cancel');
 624+ $ok = wfMsg( 'ok' );
 625+ $cancel = wfMsg( 'cancel' );
626626
627627 $sk = $wgUser->getSkin();
628628
629 - $wgOut->addHTML("<p>{$instructions}</p>" .
630 - '<form action="' . $sk->makeSpecialUrl('OpenIDServer/Trust') . '" method="POST">' .
 629+ $wgOut->addHTML( "<p>{$instructions}</p>" .
 630+ '<form action="' . $sk->makeSpecialUrl( 'OpenIDServer/Trust' ) . '" method="POST">' .
631631 '<input name="wpAllowTrust" type="checkbox" value="on" checked="checked" id="wpAllowTrust">' .
632 - '<label for="wpAllowTrust">' . $allow . '</label><br />');
 632+ '<label for="wpAllowTrust">' . $allow . '</label><br />' );
633633
634 - $fields = array_filter(array_unique(array_merge($sreg['optional'], $sreg['required'])),
635 - array($this, 'ValidField'));
 634+ $fields = array_filter( array_unique( array_merge( $sreg['optional'], $sreg['required'] ) ),
 635+ array( $this, 'ValidField' ) );
636636
637 - if (count($fields) > 0) {
638 - $wgOut->addHTML('<table>');
639 - foreach ($fields as $field) {
640 - $wgOut->addHTML("<tr>");
641 - $wgOut->addHTML("<th><label for='wpAllow{$field}'>");
642 - $wgOut->addHTML(wfMsg("openid$field"));
643 - $wgOut->addHTML("</label></th>");
644 - $value = $this->GetUserField($wgUser, $field);
645 - $wgOut->addHTML("</td>");
646 - $wgOut->addHTML("<td> " . ((is_null($value)) ? '' : $value) . "</td>");
647 - $wgOut->addHTML("<td>" . ((in_array($field, $sreg['required'])) ? wfMsg('openidrequired') : wfMsg('openidoptional')) . "</td>");
648 - $wgOut->addHTML("<td><input name='wpAllow{$field}' id='wpAllow{$field}' type='checkbox'");
649 - if (!is_null($value)) {
650 - $wgOut->addHTML(" value='on' checked='checked' />");
 637+ if ( count( $fields ) > 0 ) {
 638+ $wgOut->addHTML( '<table>' );
 639+ foreach ( $fields as $field ) {
 640+ $wgOut->addHTML( "<tr>" );
 641+ $wgOut->addHTML( "<th><label for='wpAllow{$field}'>" );
 642+ $wgOut->addHTML( wfMsg( "openid$field" ) );
 643+ $wgOut->addHTML( "</label></th>" );
 644+ $value = $this->GetUserField( $wgUser, $field );
 645+ $wgOut->addHTML( "</td>" );
 646+ $wgOut->addHTML( "<td> " . ( ( is_null( $value ) ) ? '' : $value ) . "</td>" );
 647+ $wgOut->addHTML( "<td>" . ( ( in_array( $field, $sreg['required'] ) ) ? wfMsg( 'openidrequired' ) : wfMsg( 'openidoptional' ) ) . "</td>" );
 648+ $wgOut->addHTML( "<td><input name='wpAllow{$field}' id='wpAllow{$field}' type='checkbox'" );
 649+ if ( !is_null( $value ) ) {
 650+ $wgOut->addHTML( " value='on' checked='checked' />" );
651651 } else {
652 - $wgOut->addHTML(" disabled='disabled' />");
 652+ $wgOut->addHTML( " disabled='disabled' />" );
653653 }
654 - $wgOut->addHTML("</tr>");
 654+ $wgOut->addHTML( "</tr>" );
655655 }
656 - $wgOut->addHTML('</table>');
 656+ $wgOut->addHTML( '</table>' );
657657 }
658 - $wgOut->addHTML("<input type='submit' name='wpOK' value='{$ok}' /> <input type='submit' name='wpCancel' value='{$cancel}' /></form>");
 658+ $wgOut->addHTML( "<input type='submit' name='wpOK' value='{$ok}' /> <input type='submit' name='wpCancel' value='{$cancel}' /></form>" );
659659 return NULL;
660660 }
661661
662 - function Trust($request, $sreg) {
 662+ function Trust( $request, $sreg ) {
663663 global $wgRequest, $wgUser;
664664
665 - assert(isset($request));
666 - assert(isset($sreg));
667 - assert(isset($wgRequest));
 665+ assert( isset( $request ) );
 666+ assert( isset( $sreg ) );
 667+ assert( isset( $wgRequest ) );
668668
669 - if ($wgRequest->getCheck('wpCancel')) {
670 - return $request->answer(false);
 669+ if ( $wgRequest->getCheck( 'wpCancel' ) ) {
 670+ return $request->answer( false );
671671 }
672672
673673 $trust_root = $request->trust_root;
674674
675 - assert(isset($trust_root) && strlen($trust_root) > 0);
 675+ assert( isset( $trust_root ) && strlen( $trust_root ) > 0 );
676676
677677 # If they don't want us to allow trust, save that.
678678
679 - if (!$wgRequest->getCheck('wpAllowTrust')) {
 679+ if ( !$wgRequest->getCheck( 'wpAllowTrust' ) ) {
680680
681 - $this->SetUserTrust($wgUser, $trust_root, false);
 681+ $this->SetUserTrust( $wgUser, $trust_root, false );
682682 # Set'em and sav'em
683683 $wgUser->saveSettings();
684684 } else {
685685
686 - $fields = array_filter(array_unique(array_merge($sreg['optional'], $sreg['required'])),
687 - array($this, 'ValidField'));
 686+ $fields = array_filter( array_unique( array_merge( $sreg['optional'], $sreg['required'] ) ),
 687+ array( $this, 'ValidField' ) );
688688
689689 $allow = array();
690690
691 - foreach ($fields as $field) {
692 - if ($wgRequest->getCheck('wpAllow' . $field)) {
 691+ foreach ( $fields as $field ) {
 692+ if ( $wgRequest->getCheck( 'wpAllow' . $field ) ) {
693693 $allow[] = $field;
694694 }
695695 }
696696
697 - $this->SetUserTrust($wgUser, $trust_root, $allow);
 697+ $this->SetUserTrust( $wgUser, $trust_root, $allow );
698698 # Set'em and sav'em
699699 $wgUser->saveSettings();
700700 }
@@ -702,40 +702,40 @@
703703
704704 # Converts an URL to a user name, if possible
705705
706 - function UrlToUserName($url) {
 706+ function UrlToUserName( $url ) {
707707
708708 global $wgArticlePath, $wgServer;
709709
710710 # URL must be a string
711711
712 - if (!isset($url) || !is_string($url) || strlen($url) == 0) {
 712+ if ( !isset( $url ) || !is_string( $url ) || strlen( $url ) == 0 ) {
713713 return null;
714714 }
715715
716716 # it must start with our server, case doesn't matter
717717
718 - if (strpos(strtolower($url), strtolower($wgServer)) !== 0) {
 718+ if ( strpos( strtolower( $url ), strtolower( $wgServer ) ) !== 0 ) {
719719 return null;
720720 }
721721
722 - $parts = parse_url($url);
 722+ $parts = parse_url( $url );
723723
724724 $relative = $parts['path'];
725 - if (!is_null($parts['query']) && strlen($parts['query']) > 0) {
 725+ if ( !is_null( $parts['query'] ) && strlen( $parts['query'] ) > 0 ) {
726726 $relative .= '?' . $parts['query'];
727727 }
728728
729729 # Use regexps to extract user name
730730
731 - $pattern = str_replace('$1', '(.*)', $wgArticlePath);
732 - $pattern = str_replace('?', '\?', $pattern);
 731+ $pattern = str_replace( '$1', '(.*)', $wgArticlePath );
 732+ $pattern = str_replace( '?', '\?', $pattern );
733733 # Can't have a pound-sign in the relative, since that's for fragments
734 - if (!preg_match("#$pattern#", $relative, $matches)) {
 734+ if ( !preg_match( "#$pattern#", $relative, $matches ) ) {
735735 return null;
736736 } else {
737 - $titletext = urldecode($matches[1]);
738 - $nt = Title::newFromText($titletext);
739 - if (is_null($nt) || $nt->getNamespace() != NS_USER) {
 737+ $titletext = urldecode( $matches[1] );
 738+ $nt = Title::newFromText( $titletext );
 739+ if ( is_null( $nt ) || $nt->getNamespace() != NS_USER ) {
740740 return null;
741741 } else {
742742 return $nt->getText();
@@ -744,6 +744,6 @@
745745 }
746746
747747 function serverUrl() {
748 - return $this->fullURL('OpenIDServer');
 748+ return $this->fullURL( 'OpenIDServer' );
749749 }
750750 }
Index: trunk/extensions/OpenID/SpecialOpenIDLogin.body.php
@@ -22,18 +22,18 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI'))
27 - exit(1);
 26+if ( !defined( 'MEDIAWIKI' ) )
 27+ exit( 1 );
2828
29 -require_once("Auth/OpenID/Consumer.php");
 29+require_once( "Auth/OpenID/Consumer.php" );
3030
3131 class SpecialOpenIDLogin extends SpecialOpenID {
3232
3333 function SpecialOpenIDLogin() {
34 - SpecialPage::SpecialPage("OpenIDLogin");
 34+ SpecialPage::SpecialPage( "OpenIDLogin" );
3535 }
3636
37 - function execute($par) {
 37+ function execute( $par ) {
3838 global $wgRequest, $wgUser, $wgOut, $wgScriptPath, $wgOpenIDShowProviderIcons;
3939
4040 wfLoadExtensionMessages( 'OpenID' );
@@ -46,25 +46,25 @@
4747 'rel' => 'stylesheet',
4848 'type' => 'text/css',
4949 'media' => 'screen, projection',
50 - 'href' => $oidScriptPath.($wgOpenIDShowProviderIcons ? '/skin/openid.css' : '/skin/openid-plain.css')
51 - ));
 50+ 'href' => $oidScriptPath . ( $wgOpenIDShowProviderIcons ? '/skin/openid.css' : '/skin/openid-plain.css' )
 51+ ) );
5252
53 - $wgOut->addScript('<script type="text/javascript" src="'.$oidScriptPath.'/skin/jquery-1.3.2.min.js"></script>'."\n");
54 - $wgOut->addScript('<script type="text/javascript" src="'.$oidScriptPath.'/skin/openid.js"></script>'."\n");
 53+ $wgOut->addScript( '<script type="text/javascript" src="' . $oidScriptPath . '/skin/jquery-1.3.2.min.js"></script>' . "\n" );
 54+ $wgOut->addScript( '<script type="text/javascript" src="' . $oidScriptPath . '/skin/openid.js"></script>' . "\n" );
5555
56 - if ($wgUser->getID() != 0) {
 56+ if ( $wgUser->getID() != 0 ) {
5757 $this->alreadyLoggedIn();
5858 return;
5959 }
6060
61 - if ($wgRequest->getText('returnto')) {
62 - $this->setReturnTo($wgRequest->getText('returnto'));
 61+ if ( $wgRequest->getText( 'returnto' ) ) {
 62+ $this->setReturnTo( $wgRequest->getText( 'returnto' ) );
6363 }
6464
65 - $openid_url = $wgRequest->getText('openid_url');
 65+ $openid_url = $wgRequest->getText( 'openid_url' );
6666
67 - if (isset($openid_url) && strlen($openid_url) > 0) {
68 - $this->login($openid_url);
 67+ if ( isset( $openid_url ) && strlen( $openid_url ) > 0 ) {
 68+ $this->login( $openid_url );
6969 } else {
7070 $this->loginForm();
7171 }
@@ -73,22 +73,22 @@
7474 function loginForm() {
7575 global $wgOut, $wgUser, $wgOpenIDLoginLogoUrl, $wgOpenIDShowProviderIcons;
7676 $sk = $wgUser->getSkin();
77 - $instructions = wfMsgExt('openidlogininstructions', array('parse'));
 77+ $instructions = wfMsgExt( 'openidlogininstructions', array( 'parse' ) );
7878
7979 $formsHTML = '';
8080
8181 $largeButtonsHTML = '<div id="openid_large_providers">';
82 - foreach (OpenIDProvider::getLargeProviders() as $provider) {
 82+ foreach ( OpenIDProvider::getLargeProviders() as $provider ) {
8383 $largeButtonsHTML .= $provider->getLargeButtonHTML();
8484 $formsHTML .= $provider->getLoginFormHTML();
8585 }
8686 $largeButtonsHTML .= '</div>';
8787
8888 $smallButtonsHTML = '';
89 - if ($wgOpenIDShowProviderIcons) {
 89+ if ( $wgOpenIDShowProviderIcons ) {
9090 $smallButtonsHTML .= '<div id="openid_small_providers_icons">';
91 - foreach (OpenIDProvider::getSmallProviders() as $provider) {
92 - $smallButtonsHTML .= $provider->getSmallButtonHTML();
 91+ foreach ( OpenIDProvider::getSmallProviders() as $provider ) {
 92+ $smallButtonsHTML .= $provider->getSmallButtonHTML();
9393 $formsHTML .= $provider->getLoginFormHTML();
9494 }
9595 $smallButtonsHTML .= '</div>';
@@ -101,13 +101,13 @@
102102
103103 $i = 0;
104104 $break = true;
105 - foreach ($small as $provider) {
106 - if ($break && $i > count($small)/2) {
 105+ foreach ( $small as $provider ) {
 106+ if ( $break && $i > count( $small ) / 2 ) {
107107 $smallButtonsHTML .= '</ul><ul class="openid_small_providers_block">';
108108 $break = false;
109109 }
110110
111 - $smallButtonsHTML .= '<li>'.$provider->getSmallButtonHTML().'</li>';
 111+ $smallButtonsHTML .= '<li>' . $provider->getSmallButtonHTML() . '</li>';
112112
113113 $formsHTML .= $provider->getLoginFormHTML();
114114 $i++;
@@ -116,25 +116,25 @@
117117 $smallButtonsHTML .= '</div>';
118118 }
119119
120 - $wgOut->addHTML('<form id="openid_form" action="' . $sk->makeSpecialUrl('OpenIDLogin') . '" method="POST" onsubmit="openid.update()"">' .
121 - '<fieldset><legend>' . wfMsg('openidsigninorcreateaccount') . '</legend>' .
 120+ $wgOut->addHTML( '<form id="openid_form" action="' . $sk->makeSpecialUrl( 'OpenIDLogin' ) . '" method="POST" onsubmit="openid.update()"">' .
 121+ '<fieldset><legend>' . wfMsg( 'openidsigninorcreateaccount' ) . '</legend>' .
122122 $largeButtonsHTML .
123123 '<div id="openid_input_area">' .
124124 $formsHTML .
125 - '</div>' .
 125+ '</div>' .
126126 $smallButtonsHTML .
127127 '</fieldset></form>' .
128128 $instructions
129129 );
130130 }
131131
132 - function toUserName($openid) {
133 - if (Services_Yadis_identifierScheme($openid) == 'XRI') {
134 - wfDebug("OpenID: Handling an XRI: $openid\n");
135 - return $this->toUserNameXri($openid);
 132+ function toUserName( $openid ) {
 133+ if ( Services_Yadis_identifierScheme( $openid ) == 'XRI' ) {
 134+ wfDebug( "OpenID: Handling an XRI: $openid\n" );
 135+ return $this->toUserNameXri( $openid );
136136 } else {
137 - wfDebug("OpenID: Handling an URL: $openid\n");
138 - return $this->toUserNameUrl($openid);
 137+ wfDebug( "OpenID: Handling an URL: $openid\n" );
 138+ return $this->toUserNameUrl( $openid );
139139 }
140140 }
141141
@@ -146,58 +146,58 @@
147147 $wgOut->setRobotPolicy( 'noindex,nofollow' );
148148 $wgOut->setArticleRelated( false );
149149 $wgOut->addWikiText( wfMsg( 'openidalreadyloggedin', $wgUser->getName() ) );
150 - $wgOut->returnToMain(false, $this->returnTo() );
 150+ $wgOut->returnToMain( false, $this->returnTo() );
151151 }
152152
153 - function setUserUrl($user, $url) {
154 - $other = $this->getUserUrl($user);
155 - if (isset($other)) {
156 - $this->updateUserUrl($user, $url);
 153+ function setUserUrl( $user, $url ) {
 154+ $other = $this->getUserUrl( $user );
 155+ if ( isset( $other ) ) {
 156+ $this->updateUserUrl( $user, $url );
157157 } else {
158 - $this->insertUserUrl($user, $url);
 158+ $this->insertUserUrl( $user, $url );
159159 }
160160 }
161161
162 - function insertUserUrl($user, $url) {
 162+ function insertUserUrl( $user, $url ) {
163163 global $wgSharedDB, $wgDBname;
164164 $dbw =& wfGetDB( DB_MASTER );
165165
166 - if (isset($wgSharedDB)) {
 166+ if ( isset( $wgSharedDB ) ) {
167167 # It would be nicer to get the existing dbname
168168 # and save it, but it's not possible
169 - $dbw->selectDB($wgSharedDB);
 169+ $dbw->selectDB( $wgSharedDB );
170170 }
171171
172 - $dbw->insert('user_openid', array('uoi_user' => $user->getId(),
173 - 'uoi_openid' => $url));
 172+ $dbw->insert( 'user_openid', array( 'uoi_user' => $user->getId(),
 173+ 'uoi_openid' => $url ) );
174174
175 - if (isset($wgSharedDB)) {
176 - $dbw->selectDB($wgDBname);
 175+ if ( isset( $wgSharedDB ) ) {
 176+ $dbw->selectDB( $wgDBname );
177177 }
178178 }
179179
180 - function updateUserUrl($user, $url) {
 180+ function updateUserUrl( $user, $url ) {
181181 global $wgSharedDB, $wgDBname;
182182 $dbw =& wfGetDB( DB_MASTER );
183183
184 - if (isset($wgSharedDB)) {
 184+ if ( isset( $wgSharedDB ) ) {
185185 # It would be nicer to get the existing dbname
186186 # and save it, but it's not possible
187 - $dbw->selectDB($wgSharedDB);
 187+ $dbw->selectDB( $wgSharedDB );
188188 }
189189
190 - $dbw->set('user_openid', 'uoi_openid', $url,
191 - 'uoi_user = ' . $user->getID());
 190+ $dbw->set( 'user_openid', 'uoi_openid', $url,
 191+ 'uoi_user = ' . $user->getID() );
192192
193 - if (isset($wgSharedDB)) {
194 - $dbw->selectDB($wgDBname);
 193+ if ( isset( $wgSharedDB ) ) {
 194+ $dbw->selectDB( $wgDBname );
195195 }
196196 }
197197
198 - function saveValues($response, $sreg) {
 198+ function saveValues( $response, $sreg ) {
199199 global $wgSessionStarted, $wgUser;
200200
201 - if (!$wgSessionStarted) {
 201+ if ( !$wgSessionStarted ) {
202202 $wgUser->SetupSession();
203203 }
204204
@@ -208,20 +208,20 @@
209209 }
210210
211211 function clearValues() {
212 - unset($_SESSION['openid_consumer_response']);
213 - unset($_SESSION['openid_consumer_sreg']);
 212+ unset( $_SESSION['openid_consumer_response'] );
 213+ unset( $_SESSION['openid_consumer_sreg'] );
214214 return true;
215215 }
216216
217217 function fetchValues() {
218 - return array($_SESSION['openid_consumer_response'], $_SESSION['openid_consumer_sreg']);
 218+ return array( $_SESSION['openid_consumer_response'], $_SESSION['openid_consumer_sreg'] );
219219 }
220220
221221 function returnTo() {
222222 return $_SESSION['openid_consumer_returnto'];
223223 }
224224
225 - function setReturnTo($returnto) {
 225+ function setReturnTo( $returnto ) {
226226 $_SESSION['openid_consumer_returnto'] = $returnto;
227227 }
228228 }
Index: trunk/extensions/OpenID/SpecialOpenID.body.php
@@ -25,69 +25,69 @@
2626 # FIXME: for login(); figure out better way to share this code
2727 # between Login and Convert
2828
29 -require_once("Auth/OpenID/Consumer.php");
30 -require_once("Auth/OpenID/SReg.php");
31 -require_once("Auth/OpenID/FileStore.php");
 29+require_once( "Auth/OpenID/Consumer.php" );
 30+require_once( "Auth/OpenID/SReg.php" );
 31+require_once( "Auth/OpenID/FileStore.php" );
3232
3333 class SpecialOpenID extends SpecialPage {
3434
35 - function getOpenIDStore($storeType, $prefix, $options) {
36 - global $wgOut;
 35+ function getOpenIDStore( $storeType, $prefix, $options ) {
 36+ global $wgOut;
3737
3838 # FIXME: support other kinds of store
3939 # XXX: used to support memc, now use memcached from php-openid
4040
41 - switch ($storeType) {
 41+ switch ( $storeType ) {
4242
43 - case 'file':
 43+ case 'file':
4444 # Auto-create path if it doesn't exist
45 - if (!is_dir($options['path'])) {
46 - if (!mkdir($options['path'], 0770, true)) {
47 - $wgOut->showErrorPage('openidconfigerror', 'openidconfigerrortext');
 45+ if ( !is_dir( $options['path'] ) ) {
 46+ if ( !mkdir( $options['path'], 0770, true ) ) {
 47+ $wgOut->showErrorPage( 'openidconfigerror', 'openidconfigerrortext' );
4848 return NULL;
4949 }
5050 }
51 - return new Auth_OpenID_FileStore($options['path']);
 51+ return new Auth_OpenID_FileStore( $options['path'] );
5252
5353 default:
54 - $wgOut->showErrorPage('openidconfigerror', 'openidconfigerrortext');
55 - }
 54+ $wgOut->showErrorPage( 'openidconfigerror', 'openidconfigerrortext' );
 55+ }
5656 }
5757
58 - function xriBase($xri) {
59 - if (substr($xri, 0, 6) == 'xri://') {
60 - return substr($xri, 6);
 58+ function xriBase( $xri ) {
 59+ if ( substr( $xri, 0, 6 ) == 'xri://' ) {
 60+ return substr( $xri, 6 );
6161 } else {
6262 return $xri;
6363 }
6464 }
6565
66 - function xriToUrl($xri) {
67 - return 'http://xri.net/' . OpenIDXriBase($xri);
 66+ function xriToUrl( $xri ) {
 67+ return 'http://xri.net/' . OpenIDXriBase( $xri );
6868 }
6969
70 - static function OpenIDToUrl($openid) {
 70+ static function OpenIDToUrl( $openid ) {
7171 /* ID is either an URL already or an i-name */
72 - if (Auth_Yadis_identifierScheme($openid) == 'XRI') {
73 - return OpenIDXriToUrl($openid);
 72+ if ( Auth_Yadis_identifierScheme( $openid ) == 'XRI' ) {
 73+ return OpenIDXriToUrl( $openid );
7474 } else {
7575 return $openid;
7676 }
7777 }
7878
79 - function interwikiExpand($openid_url) {
 79+ function interwikiExpand( $openid_url ) {
8080 # try to make it into a title object
81 - $nt = Title::newFromText($openid_url);
 81+ $nt = Title::newFromText( $openid_url );
8282 # If it's got an iw, return that
83 - if (!is_null($nt) && !is_null($nt->getInterwiki())
84 - && strlen($nt->getInterwiki()) > 0) {
 83+ if ( !is_null( $nt ) && !is_null( $nt->getInterwiki() )
 84+ && strlen( $nt->getInterwiki() ) > 0 ) {
8585 return $nt->getFullUrl();
8686 } else {
8787 return $openid_url;
8888 }
8989 }
9090
91 - static function getUserUrl($user) {
 91+ static function getUserUrl( $user ) {
9292 $openid_url = null;
9393
9494 if ( isset( $user ) && $user->getId() != 0 ) {
@@ -122,26 +122,26 @@
123123 function getConsumer() {
124124 global $wgOpenIDConsumerStoreType, $wgOpenIDConsumerStorePath;
125125
126 - $store = $this->getOpenIDStore($wgOpenIDConsumerStoreType,
 126+ $store = $this->getOpenIDStore( $wgOpenIDConsumerStoreType,
127127 'consumer',
128 - array('path' => $wgOpenIDConsumerStorePath));
 128+ array( 'path' => $wgOpenIDConsumerStorePath ) );
129129
130 - return new Auth_OpenID_Consumer($store);
 130+ return new Auth_OpenID_Consumer( $store );
131131 }
132132
133 - function fullUrl($title) {
134 - $nt = Title::makeTitleSafe(NS_SPECIAL, $title);
135 - if (isset($nt)) {
 133+ function fullUrl( $title ) {
 134+ $nt = Title::makeTitleSafe( NS_SPECIAL, $title );
 135+ if ( isset( $nt ) ) {
136136 return $nt->getFullURL();
137137 } else {
138138 return NULL;
139139 }
140140 }
141141
142 - function scriptUrl($title) {
 142+ function scriptUrl( $title ) {
143143 global $wgServer, $wgScript;
144 - $nt = Title::makeTitleSafe(NS_SPECIAL, $title);
145 - if (isset($nt)) {
 144+ $nt = Title::makeTitleSafe( NS_SPECIAL, $title );
 145+ if ( isset( $nt ) ) {
146146 $dbkey = wfUrlencode( $nt->getPrefixedDBkey() );
147147 return "{$wgServer}{$wgScript}?title={$dbkey}";
148148 } else {
@@ -149,23 +149,23 @@
150150 }
151151 }
152152
153 - function canLogin($openid_url) {
 153+ function canLogin( $openid_url ) {
154154
155155 global $wgOpenIDConsumerDenyByDefault, $wgOpenIDConsumerAllow, $wgOpenIDConsumerDeny;
156156
157 - if ($this->isLocalUrl($openid_url)) {
 157+ if ( $this->isLocalUrl( $openid_url ) ) {
158158 return false;
159159 }
160160
161 - if ($wgOpenIDConsumerDenyByDefault) {
 161+ if ( $wgOpenIDConsumerDenyByDefault ) {
162162 $canLogin = false;
163 - foreach ($wgOpenIDConsumerAllow as $allow) {
164 - if (preg_match($allow, $openid_url)) {
165 - wfDebug("OpenID: $openid_url matched allow pattern $allow.\n");
 163+ foreach ( $wgOpenIDConsumerAllow as $allow ) {
 164+ if ( preg_match( $allow, $openid_url ) ) {
 165+ wfDebug( "OpenID: $openid_url matched allow pattern $allow.\n" );
166166 $canLogin = true;
167 - foreach ($wgOpenIDConsumerDeny as $deny) {
168 - if (preg_match($deny, $openid_url)) {
169 - wfDebug("OpenID: $openid_url matched deny pattern $deny.\n");
 167+ foreach ( $wgOpenIDConsumerDeny as $deny ) {
 168+ if ( preg_match( $deny, $openid_url ) ) {
 169+ wfDebug( "OpenID: $openid_url matched deny pattern $deny.\n" );
170170 $canLogin = false;
171171 break;
172172 }
@@ -175,13 +175,13 @@
176176 }
177177 } else {
178178 $canLogin = true;
179 - foreach ($wgOpenIDConsumerDeny as $deny) {
180 - if (preg_match($deny, $openid_url)) {
181 - wfDebug("OpenID: $openid_url matched deny pattern $deny.\n");
 179+ foreach ( $wgOpenIDConsumerDeny as $deny ) {
 180+ if ( preg_match( $deny, $openid_url ) ) {
 181+ wfDebug( "OpenID: $openid_url matched deny pattern $deny.\n" );
182182 $canLogin = false;
183 - foreach ($wgOpenIDConsumerAllow as $allow) {
184 - if (preg_match($allow, $openid_url)) {
185 - wfDebug("OpenID: $openid_url matched allow pattern $allow.\n");
 183+ foreach ( $wgOpenIDConsumerAllow as $allow ) {
 184+ if ( preg_match( $allow, $openid_url ) ) {
 185+ wfDebug( "OpenID: $openid_url matched allow pattern $allow.\n" );
186186 $canLogin = true;
187187 break;
188188 }
@@ -193,67 +193,67 @@
194194 return $canLogin;
195195 }
196196
197 - function isLocalUrl($url) {
 197+ function isLocalUrl( $url ) {
198198
199199 global $wgServer, $wgArticlePath;
200200
201201 $pattern = $wgServer . $wgArticlePath;
202 - $pattern = str_replace('$1', '(.*)', $pattern);
203 - $pattern = str_replace('?', '\?', $pattern);
 202+ $pattern = str_replace( '$1', '(.*)', $pattern );
 203+ $pattern = str_replace( '?', '\?', $pattern );
204204
205 - return preg_match('|^' . $pattern . '$|', $url);
 205+ return preg_match( '|^' . $pattern . '$|', $url );
206206 }
207207
208208 # Find the user with the given openid, if any
209209
210 - function getUser($openid) {
 210+ function getUser( $openid ) {
211211 global $wgSharedDB, $wgDBprefix;
212212
213 - if (isset($wgSharedDB)) {
 213+ if ( isset( $wgSharedDB ) ) {
214214 $tableName = "`$wgSharedDB`.${wgDBprefix}user_openid";
215215 } else {
216216 $tableName = 'user_openid';
217217 }
218218
219219 $dbr =& wfGetDB( DB_SLAVE );
220 - $id = $dbr->selectField($tableName, 'uoi_user',
221 - array('uoi_openid' => $openid));
222 - if ($id) {
223 - $name = User::whoIs($id);
224 - return User::newFromName($name);
 220+ $id = $dbr->selectField( $tableName, 'uoi_user',
 221+ array( 'uoi_openid' => $openid ) );
 222+ if ( $id ) {
 223+ $name = User::whoIs( $id );
 224+ return User::newFromName( $name );
225225 } else {
226226 return NULL;
227227 }
228228 }
229 - function login($openid_url, $finish_page = 'OpenIDFinish') {
 229+ function login( $openid_url, $finish_page = 'OpenIDFinish' ) {
230230
231231 global $wgUser, $wgTrustRoot, $wgOut;
232232
233233 # If it's an interwiki link, expand it
234234
235 - $openid_url = $this->interwikiExpand($openid_url);
 235+ $openid_url = $this->interwikiExpand( $openid_url );
236236
237237 # Check if the URL is allowed
238238
239 - if (!$this->canLogin($openid_url)) {
240 - $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
 239+ if ( !$this->canLogin( $openid_url ) ) {
 240+ $wgOut->showErrorPage( 'openidpermission', 'openidpermissiontext' );
241241 return;
242242 }
243243
244244 $sk = $wgUser->getSkin();
245245
246 - if (isset($wgTrustRoot)) {
 246+ if ( isset( $wgTrustRoot ) ) {
247247 $trust_root = $wgTrustRoot;
248248 } else {
249249 global $wgArticlePath, $wgServer;
250 - $root_article = str_replace('$1', '', $wgArticlePath);
 250+ $root_article = str_replace( '$1', '', $wgArticlePath );
251251 $trust_root = $wgServer . $root_article;
252252 }
253253
254254 $consumer = $this->getConsumer();
255255
256 - if (!$consumer) {
257 - $wgOut->showErrorPage('openiderror', 'openiderrortext');
 256+ if ( !$consumer ) {
 257+ $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
258258 return;
259259 }
260260
@@ -261,15 +261,15 @@
262262
263263 global $wgSessionStarted;
264264
265 - if (!$wgSessionStarted) {
 265+ if ( !$wgSessionStarted ) {
266266 $wgUser->SetupSession();
267267 }
268268
269 - $auth_request = $consumer->begin($openid_url);
 269+ $auth_request = $consumer->begin( $openid_url );
270270
271271 // Handle failure status return values.
272 - if (!$auth_request) {
273 - $wgOut->showErrorPage('openiderror', 'openiderrortext');
 272+ if ( !$auth_request ) {
 273+ $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
274274 return;
275275 }
276276
@@ -277,16 +277,16 @@
278278
279279 $endpoint = $auth_request->endpoint;
280280
281 - if (isset($endpoint)) {
 281+ if ( isset( $endpoint ) ) {
282282 # Check if the URL is allowed
283283
284 - if (isset($endpoint->identity_url) && !$this->canLogin($endpoint->identity_url)) {
285 - $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
 284+ if ( isset( $endpoint->identity_url ) && !$this->canLogin( $endpoint->identity_url ) ) {
 285+ $wgOut->showErrorPage( 'openidpermission', 'openidpermissiontext' );
286286 return;
287287 }
288288
289 - if (isset($endpoint->delegate) && !$this->canLogin($endpoint->delegate)) {
290 - $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
 289+ if ( isset( $endpoint->delegate ) && !$this->canLogin( $endpoint->delegate ) ) {
 290+ $wgOut->showErrorPage( 'openidpermission', 'openidpermissiontext' );
291291 return;
292292 }
293293 }
@@ -295,84 +295,84 @@
296296 // Required
297297 array(),
298298 // Optional
299 - array('nickname','email',
300 - 'fullname','language','timezone'));
 299+ array( 'nickname', 'email',
 300+ 'fullname', 'language', 'timezone' ) );
301301
302 - if ($sreg_request) {
303 - $auth_request->addExtension($sreg_request);
 302+ if ( $sreg_request ) {
 303+ $auth_request->addExtension( $sreg_request );
304304 }
305305
306 - $process_url = $this->scriptUrl($finish_page);
 306+ $process_url = $this->scriptUrl( $finish_page );
307307
308 - if ($auth_request->shouldSendRedirect()) {
309 - $redirect_url = $auth_request->redirectURL($trust_root,
310 - $process_url);
311 - if (Auth_OpenID::isFailure($redirect_url)) {
312 - displayError("Could not redirect to server: " . $redirect_url->message);
 308+ if ( $auth_request->shouldSendRedirect() ) {
 309+ $redirect_url = $auth_request->redirectURL( $trust_root,
 310+ $process_url );
 311+ if ( Auth_OpenID::isFailure( $redirect_url ) ) {
 312+ displayError( "Could not redirect to server: " . $redirect_url->message );
313313 } else {
314314 # OK, now go
315 - $wgOut->redirect($redirect_url);
 315+ $wgOut->redirect( $redirect_url );
316316 }
317317 } else {
318318 // Generate form markup and render it.
319319 $form_id = 'openid_message';
320 - $form_html = $auth_request->formMarkup($trust_root, $process_url,
321 - false, array('id' => $form_id));
 320+ $form_html = $auth_request->formMarkup( $trust_root, $process_url,
 321+ false, array( 'id' => $form_id ) );
322322
323323 // Display an error if the form markup couldn't be generated;
324324 // otherwise, render the HTML.
325 - if (Auth_OpenID::isFailure($form_html)) {
326 - displayError("Could not redirect to server: " . $form_html->message);
 325+ if ( Auth_OpenID::isFailure( $form_html ) ) {
 326+ displayError( "Could not redirect to server: " . $form_html->message );
327327 } else {
328 - $wgOut->addHTML("<p>" . wfMsg("openidautosubmit") . "</p>");
329 - $wgOut->addHTML($form_html);
330 - $wgOut->addInlineScript("function submitOpenIDForm() {\n document.getElementById(\"".$form_id."\").submit()\n }\nhookEvent(\"load\", submitOpenIDForm);\n");
 328+ $wgOut->addHTML( "<p>" . wfMsg( "openidautosubmit" ) . "</p>" );
 329+ $wgOut->addHTML( $form_html );
 330+ $wgOut->addInlineScript( "function submitOpenIDForm() {\n document.getElementById(\"" . $form_id . "\").submit()\n }\nhookEvent(\"load\", submitOpenIDForm);\n" );
331331 }
332332 }
333333 }
334 -
335 - function setUserUrl($user, $url) {
336 - $other = $this->getUserUrl($user);
337 - if (isset($other)) {
338 - $this->updateUserUrl($user, $url);
 334+
 335+ function setUserUrl( $user, $url ) {
 336+ $other = $this->getUserUrl( $user );
 337+ if ( isset( $other ) ) {
 338+ $this->updateUserUrl( $user, $url );
339339 } else {
340 - $this->insertUserUrl($user, $url);
 340+ $this->insertUserUrl( $user, $url );
341341 }
342342 }
343343
344 - function insertUserUrl($user, $url) {
 344+ function insertUserUrl( $user, $url ) {
345345 global $wgSharedDB, $wgDBname;
346346 $dbw =& wfGetDB( DB_MASTER );
347347
348 - if (isset($wgSharedDB)) {
 348+ if ( isset( $wgSharedDB ) ) {
349349 # It would be nicer to get the existing dbname
350350 # and save it, but it's not possible
351 - $dbw->selectDB($wgSharedDB);
 351+ $dbw->selectDB( $wgSharedDB );
352352 }
353353
354 - $dbw->insert('user_openid', array('uoi_user' => $user->getId(),
355 - 'uoi_openid' => $url));
 354+ $dbw->insert( 'user_openid', array( 'uoi_user' => $user->getId(),
 355+ 'uoi_openid' => $url ) );
356356
357 - if (isset($wgSharedDB)) {
358 - $dbw->selectDB($wgDBname);
 357+ if ( isset( $wgSharedDB ) ) {
 358+ $dbw->selectDB( $wgDBname );
359359 }
360360 }
361361
362 - function updateUserUrl($user, $url) {
 362+ function updateUserUrl( $user, $url ) {
363363 global $wgSharedDB, $wgDBname;
364364 $dbw =& wfGetDB( DB_MASTER );
365365
366 - if (isset($wgSharedDB)) {
 366+ if ( isset( $wgSharedDB ) ) {
367367 # It would be nicer to get the existing dbname
368368 # and save it, but it's not possible
369 - $dbw->selectDB($wgSharedDB);
 369+ $dbw->selectDB( $wgSharedDB );
370370 }
371371
372 - $dbw->set('user_openid', 'uoi_openid', $url,
373 - 'uoi_user = ' . $user->getID());
 372+ $dbw->set( 'user_openid', 'uoi_openid', $url,
 373+ 'uoi_user = ' . $user->getID() );
374374
375 - if (isset($wgSharedDB)) {
376 - $dbw->selectDB($wgDBname);
 375+ if ( isset( $wgSharedDB ) ) {
 376+ $dbw->selectDB( $wgDBname );
377377 }
378378 }
379379 }
Index: trunk/extensions/OpenID/SpecialOpenIDConvert.body.php
@@ -22,17 +22,17 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI')) {
 26+if ( !defined( 'MEDIAWIKI' ) ) {
2727 exit( 1 );
2828 }
2929
3030 class SpecialOpenIDConvert extends SpecialOpenID {
3131
3232 function SpecialOpenIDConvert() {
33 - SpecialPage::SpecialPage("OpenIDConvert");
 33+ SpecialPage::SpecialPage( "OpenIDConvert" );
3434 }
3535
36 - function execute($par) {
 36+ function execute( $par ) {
3737
3838 global $wgRequest, $wgUser, $wgOut;
3939
@@ -40,76 +40,76 @@
4141
4242 $this->setHeaders();
4343
44 - if ($wgUser->getID() == 0) {
45 - $wgOut->showErrorPage('openiderror', 'notloggedin');
 44+ if ( $wgUser->getID() == 0 ) {
 45+ $wgOut->showErrorPage( 'openiderror', 'notloggedin' );
4646 return;
4747 }
4848
49 - switch ($par) {
 49+ switch ( $par ) {
5050 case 'Finish':
5151 $this->finish();
5252 break;
5353 default:
54 - $openid_url = $wgRequest->getText('openid_url');
55 - if (isset($openid_url) && strlen($openid_url) > 0) {
56 - $this->convert($openid_url);
 54+ $openid_url = $wgRequest->getText( 'openid_url' );
 55+ if ( isset( $openid_url ) && strlen( $openid_url ) > 0 ) {
 56+ $this->convert( $openid_url );
5757 } else {
5858 $this->Form();
5959 }
6060 }
6161 }
6262
63 - function convert($openid_url) {
 63+ function convert( $openid_url ) {
6464
6565 global $wgUser, $wgOut;
6666
6767 # Expand Interwiki
6868
69 - $openid_url = $this->interwikiExpand($openid_url);
 69+ $openid_url = $this->interwikiExpand( $openid_url );
7070
7171 # Is this ID allowed to log in?
7272
73 - if (!$this->CanLogin($openid_url)) {
74 - $wgOut->showErrorPage('openidpermission', 'openidpermissiontext');
 73+ if ( !$this->CanLogin( $openid_url ) ) {
 74+ $wgOut->showErrorPage( 'openidpermission', 'openidpermissiontext' );
7575 return;
7676 }
7777
7878 # Is this ID already taken?
7979
80 - $other = $this->getUser($openid_url);
 80+ $other = $this->getUser( $openid_url );
8181
82 - if (isset($other)) {
83 - if ($other->getId() == $wgUser->getID()) {
84 - $wgOut->showErrorPage('openiderror', 'openidconvertyourstext');
 82+ if ( isset( $other ) ) {
 83+ if ( $other->getId() == $wgUser->getID() ) {
 84+ $wgOut->showErrorPage( 'openiderror', 'openidconvertyourstext' );
8585 } else {
86 - $wgOut->showErrorPage('openiderror', 'openidconvertothertext');
 86+ $wgOut->showErrorPage( 'openiderror', 'openidconvertothertext' );
8787 }
8888 return;
8989 }
9090
9191 # If we're OK to here, let the user go log in
9292
93 - $this->Login($openid_url, 'OpenIDConvert/Finish');
 93+ $this->Login( $openid_url, 'OpenIDConvert/Finish' );
9494 }
9595
9696 function form() {
9797 global $wgOut, $wgUser;
9898 $sk = $wgUser->getSkin();
99 - $url = $this->GetUserUrl($wgUser);
100 - if (is_null($url)) {
 99+ $url = $this->GetUserUrl( $wgUser );
 100+ if ( is_null( $url ) ) {
101101 $url = '';
102102 }
103103
104 - $ok = wfMsg('ok');
105 - $instructions = wfMsg('openidconvertinstructions');
106 - $wgOut->addHTML("<p>{$instructions}</p>" .
107 - '<form action="' . $sk->makeSpecialUrl('OpenIDConvert') . '" method="POST">' .
 104+ $ok = wfMsg( 'ok' );
 105+ $instructions = wfMsg( 'openidconvertinstructions' );
 106+ $wgOut->addHTML( "<p>{$instructions}</p>" .
 107+ '<form action="' . $sk->makeSpecialUrl( 'OpenIDConvert' ) . '" method="POST">' .
108108 '<input type="text" name="openid_url" size="30" ' .
109109 ' style="background: url(http://www.openid.net/login-bg.gif) ' .
110110 ' no-repeat; background-color: #fff; background-position: 0 50%; ' .
111111 ' color: #000; padding-left: 18px;" value="' . $url . '" />' .
112112 '<input type="submit" value="' . $ok . '" />' .
113 - '</form>');
 113+ '</form>' );
114114 }
115115
116116 function finish() {
@@ -118,48 +118,48 @@
119119
120120 $consumer = $this->getConsumer();
121121
122 - $response = $consumer->complete($this->scriptUrl('OpenIDConvert/Finish'));
 122+ $response = $consumer->complete( $this->scriptUrl( 'OpenIDConvert/Finish' ) );
123123
124 - if (!isset($response)) {
125 - wfDebug("OpenID: aborting in openid converter because the response was missing\n");
126 - $wgOut->showErrorPage('openiderror', 'openiderrortext');
 124+ if ( !isset( $response ) ) {
 125+ wfDebug( "OpenID: aborting in openid converter because the response was missing\n" );
 126+ $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
127127 return;
128128 }
129129
130 - switch ($response->status) {
 130+ switch ( $response->status ) {
131131 case Auth_OpenID_CANCEL:
132132 // This means the authentication was cancelled.
133 - $wgOut->showErrorPage('openidcancel', 'openidcanceltext');
 133+ $wgOut->showErrorPage( 'openidcancel', 'openidcanceltext' );
134134 break;
135135 case Auth_OpenID_FAILURE:
136 - wfDebug("OpenID: error in convert: '" . $response->message . "'\n");
137 - $wgOut->showErrorPage('openidfailure', 'openidfailuretext', array($response->message));
 136+ wfDebug( "OpenID: error in convert: '" . $response->message . "'\n" );
 137+ $wgOut->showErrorPage( 'openidfailure', 'openidfailuretext', array( $response->message ) );
138138 break;
139139 case Auth_OpenID_SUCCESS:
140140 // This means the authentication succeeded.
141141 $openid_url = $response->identity_url;
142142
143 - if (!isset($openid_url)) {
144 - wfDebug("OpenID: aborting in openid converter because the openid_url was missing\n");
145 - $wgOut->showErrorPage('openiderror', 'openiderrortext');
 143+ if ( !isset( $openid_url ) ) {
 144+ wfDebug( "OpenID: aborting in openid converter because the openid_url was missing\n" );
 145+ $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
146146 return;
147147 }
148148
149149 # We check again for dupes; this may be normalized or
150150 # reformatted by the server.
151151
152 - $other = $this->getUser($openid_url);
 152+ $other = $this->getUser( $openid_url );
153153
154 - if (isset($other)) {
155 - if ($other->getId() == $wgUser->getID()) {
156 - $wgOut->showErrorPage('openiderror', 'openidconvertyourstext');
 154+ if ( isset( $other ) ) {
 155+ if ( $other->getId() == $wgUser->getID() ) {
 156+ $wgOut->showErrorPage( 'openiderror', 'openidconvertyourstext' );
157157 } else {
158 - $wgOut->showErrorPage('openiderror', 'openidconvertothertext');
 158+ $wgOut->showErrorPage( 'openiderror', 'openidconvertothertext' );
159159 }
160160 return;
161161 }
162162
163 - $this->setUserUrl($wgUser, $openid_url);
 163+ $this->setUserUrl( $wgUser, $openid_url );
164164
165165 $wgOut->setPageTitle( wfMsg( 'openidconvertsuccess' ) );
166166 $wgOut->setRobotPolicy( 'noindex,nofollow' );
Index: trunk/extensions/OpenID/SpecialOpenIDFinish.body.php
@@ -22,20 +22,19 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI'))
27 - exit(1);
 26+if ( !defined( 'MEDIAWIKI' ) )
 27+ exit( 1 );
2828
29 -require_once("Auth/OpenID/Consumer.php");
30 -require_once("Auth/OpenID/SReg.php");
31 -require_once("Auth/Yadis/XRI.php");
 29+require_once( "Auth/OpenID/Consumer.php" );
 30+require_once( "Auth/OpenID/SReg.php" );
 31+require_once( "Auth/Yadis/XRI.php" );
3232
3333 class SpecialOpenIDFinish extends SpecialOpenID {
34 -
3534 function SpecialOpenIDFinish() {
36 - SpecialPage::SpecialPage("OpenIDFinish", '', false);
 35+ SpecialPage::SpecialPage( "OpenIDFinish", '', false );
3736 }
3837
39 - function execute( $par) {
 38+ function execute( $par ) {
4039
4140 global $wgUser, $wgOut, $wgRequest;
4241
@@ -54,7 +53,7 @@
5554
5655 switch ( $par ) {
5756 case 'ChooseName':
58 - list( $openid, $sreg) = $this->fetchValues();
 57+ list( $openid, $sreg ) = $this->fetchValues();
5958 if ( !isset( $openid ) ) {
6059 wfDebug( "OpenID: aborting in ChooseName because identity_url is missing\n" );
6160 $this->clearValues();
@@ -72,7 +71,7 @@
7372 $choice = $wgRequest->getText( 'wpNameChoice' );
7473 $nameValue = $wgRequest->getText( 'wpNameValue' );
7574
76 - if ($choice == 'existing') {
 75+ if ( $choice == 'existing' ) {
7776 $user = $this->attachUser( $openid, $sreg,
7877 $wgRequest->getText( 'wpExistingName' ),
7978 $wgRequest->getText( 'wpExistingPassword' )
@@ -83,19 +82,19 @@
8483 return;
8584 }
8685
87 - if ($wgRequest->getText( 'wpUpdateUserInfo' ))
 86+ if ( $wgRequest->getText( 'wpUpdateUserInfo' ) )
8887 {
8988 $this->updateUser( $user, $sreg );
9089 }
9190 } else {
92 - $name = $this->getUserName( $openid, $sreg, $choice, $nameValue);
 91+ $name = $this->getUserName( $openid, $sreg, $choice, $nameValue );
9392
9493 if ( !$name || !$this->userNameOK( $name ) ) {
9594 wfDebug( "OpenID: Name not OK: '$name'\n" );
9695 $this->chooseNameForm( $openid, $sreg );
9796 return;
9897 }
99 -
 98+
10099 $user = $this->createUser( $openid, $sreg, $name );
101100 }
102101
@@ -139,7 +138,7 @@
140139 $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse( $response );
141140 $sreg = $sreg_resp->contents();
142141
143 - if (!isset($openid)) {
 142+ if ( !isset( $openid ) ) {
144143 wfDebug( "OpenID: aborting in auth success because display identifier is missing\n" );
145144 $wgOut->showErrorPage( 'openiderror', 'openiderrortext' );
146145 return;
@@ -149,9 +148,9 @@
150149
151150 if ( isset( $user ) )
152151 {
153 - if ($user->getOption('openid-update-userinfo-on-login'))
 152+ if ( $user->getOption( 'openid-update-userinfo-on-login' ) )
154153 {
155 - $this->updateUser( $user, $sreg); # update from server
 154+ $this->updateUser( $user, $sreg ); # update from server
156155 }
157156 } else {
158157 # For easy names
@@ -189,7 +188,7 @@
190189
191190 # Set a cookie for later check-immediate use
192191
193 - $this->loginSetCookie($openid);
 192+ $this->loginSetCookie( $openid );
194193
195194 $wgOut->setPageTitle( wfMsg( 'openidsuccess' ) );
196195 $wgOut->setRobotPolicy( 'noindex,nofollow' );
@@ -205,15 +204,15 @@
206205
207206 $exp = time() + $wgOpenIDCookieExpiration;
208207
209 - setcookie( $wgCookiePrefix.'OpenID', $openid, $exp, $wgCookiePath, $wgCookieDomain, $wgCookieSecure );
 208+ setcookie( $wgCookiePrefix . 'OpenID', $openid, $exp, $wgCookiePath, $wgCookieDomain, $wgCookieSecure );
210209 }
211210
212211 function chooseNameForm( $openid, $sreg, $messagekey = NULL ) {
213212
214213 global $wgOut, $wgUser, $wgOpenIDOnly;
215 -
 214+
216215 $sk = $wgUser->getSkin();
217 - if ($messagekey) {
 216+ if ( $messagekey ) {
218217 $message = wfMsg( $messagekey );
219218 } else if ( array_key_exists( 'nickname', $sreg ) ) {
220219 $message = wfMsg( 'openidnotavailable', $sreg['nickname'] );
@@ -228,9 +227,9 @@
229228
230229 if ( !$wgOpenIDOnly ) {
231230 # Let them attach it to an existing user
232 -
 231+
233232 # Grab the UserName in the cookie if it exists
234 -
 233+
235234 global $wgCookiePrefix;
236235 $name = '';
237236 if ( isset( $_COOKIE["{$wgCookiePrefix}UserName"] ) ) {
@@ -238,39 +237,39 @@
239238 }
240239
241240 # show OpenID Attributes
242 - $oidAttributesToAccept = array('fullname', 'nickname', 'email', 'language');
 241+ $oidAttributesToAccept = array( 'fullname', 'nickname', 'email', 'language' );
243242 $oidAttributes = array();
244243
245 - foreach ($oidAttributesToAccept as $oidAttr)
 244+ foreach ( $oidAttributesToAccept as $oidAttr )
246245 {
247 - if ($oidAttr == 'fullname' && !$wgAllowRealName)
 246+ if ( $oidAttr == 'fullname' && !$wgAllowRealName )
248247 {
249248 next;
250249 }
251250
252 - if ( array_key_exists( $oidAttr, $sreg )) {
253 - $oidAttributes[] = '<div>'.wfMsg( "openid$oidAttr" ).': <i>'.$sreg[$oidAttr].'</i></div>';
 251+ if ( array_key_exists( $oidAttr, $sreg ) ) {
 252+ $oidAttributes[] = '<div>' . wfMsg( "openid$oidAttr" ) . ': <i>' . $sreg[$oidAttr] . '</i></div>';
254253 }
255254 }
256255
257256 $oidAttributesUpdate = '';
258 - if (count($oidAttributes) > 0)
 257+ if ( count( $oidAttributes ) > 0 )
259258 {
260 - $oidAttributesUpdate = '<div style="margin-left: 25px">'.
 259+ $oidAttributesUpdate = '<div style="margin-left: 25px">' .
261260 '<input type="checkbox" name="wpUpdateUserInfo" id="wpUpdateUserInfo">' .
262261 '<label for="wpUpdateUserInfo">' . wfMsg( "openidupdateuserinfo" ) .
263 - '<div style="margin-left: 25px">'.implode('', $oidAttributes).'</div>'.
 262+ '<div style="margin-left: 25px">' . implode( '', $oidAttributes ) . '</div>' .
264263 '</label></div>';
265264 }
266 -
267 - $wgOut->addHTML("<div><input type='radio' name='wpNameChoice' id='wpNameChoiceExisting' value='existing' />" .
 265+
 266+ $wgOut->addHTML( "<div><input type='radio' name='wpNameChoice' id='wpNameChoiceExisting' value='existing' />" .
268267 "<label for='wpNameChoiceExisting'>" . wfMsg( "openidchooseexisting" ) . "</label> " .
269268 "<input type='text' name='wpExistingName' id='wpExistingName' size='16' value='{$name}'> " .
270269 "<label for='wpExistingPassword'>" . wfMsg( "openidchoosepassword" ) . "</label> " .
271270 "<input type='password' name='wpExistingPassword' size='8' /> " .
272271 $oidAttributesUpdate . "</div>\n" );
273272 }
274 -
 273+
275274 # These options won't exist if we can't get them.
276275
277276 if ( array_key_exists( 'fullname', $sreg ) && $this->userNameOK( $sreg['fullname'] ) ) {
@@ -293,14 +292,14 @@
294293
295294 $wgOut->addHTML( "<div><input type='radio' name='wpNameChoice' id='wpNameChoiceAuto' value='auto' " .
296295 ( ( !$def ) ? "checked = 'checked'" : "" ) . " />" .
297 - "<label for='wpNameChoiceAuto'>" . wfMsg( "openidchooseauto", $this->automaticName( $sreg ) ) . "</label></div>\n");
 296+ "<label for='wpNameChoiceAuto'>" . wfMsg( "openidchooseauto", $this->automaticName( $sreg ) ) . "</label></div>\n" );
298297
299298 $def = true;
300299
301 - $wgOut->addHTML("<div><input type='radio' name='wpNameChoice' id='wpNameChoiceManual' value='manual' " .
 300+ $wgOut->addHTML( "<div><input type='radio' name='wpNameChoice' id='wpNameChoiceManual' value='manual' " .
302301 " checked='off' />" .
303302 "<label for='wpNameChoiceManual'>" . wfMsg( "openidchoosemanual" ) . "</label> " .
304 - "<input type='text' name='wpNameValue' id='wpNameValue' size='16' /></div>\n");
 303+ "<input type='text' name='wpNameValue' id='wpNameValue' size='16' /></div>\n" );
305304
306305 $ok = wfMsg( 'login' );
307306 $cancel = wfMsg( 'cancel' );
@@ -391,13 +390,13 @@
392391 global $wgAllowRealName;
393392
394393 # FIXME: only update if there's been a change
395 - $user->setOption('nickname', array_key_exists( 'nickname', $sreg )
396 - ? $sreg['nickname'] : '');
 394+ $user->setOption( 'nickname', array_key_exists( 'nickname', $sreg )
 395+ ? $sreg['nickname'] : '' );
397396
398397 $user->setEmail( array_key_exists( 'email', $sreg ) ? $sreg['email'] : '' );
399398
400 - $user->setRealName( (array_key_exists( 'fullname', $sreg ) && $wgAllowRealName)
401 - ? $sreg['fullname'] : '');
 399+ $user->setRealName( ( array_key_exists( 'fullname', $sreg ) && $wgAllowRealName )
 400+ ? $sreg['fullname'] : '' );
402401
403402 if ( array_key_exists( 'language', $sreg ) ) {
404403 # FIXME: check and make sure the language exists
@@ -406,7 +405,7 @@
407406 $user->setOption( 'language', NULL );
408407 }
409408
410 - if (array_key_exists( 'timezone', $sreg ) ) {
 409+ if ( array_key_exists( 'timezone', $sreg ) ) {
411410 # FIXME: do something with it.
412411 # $offset = OpenIDTimezoneToTzoffset($sreg['timezone']);
413412 # $user->setOption('timecorrection', $offset);
@@ -417,39 +416,39 @@
418417 $user->saveSettings();
419418 }
420419
421 - function createUser($openid, $sreg, $name) {
 420+ function createUser( $openid, $sreg, $name ) {
422421
423422 global $wgAuth, $wgAllowRealName;
424423
425 - $user = User::newFromName($name);
 424+ $user = User::newFromName( $name );
426425
427 - if (!$user) {
428 - wfDebug("OpenID: Error adding new user.\n");
 426+ if ( !$user ) {
 427+ wfDebug( "OpenID: Error adding new user.\n" );
429428 return NULL;
430429 }
431 -
 430+
432431 $user->addToDatabase();
433432
434 - if (!$user->getId()) {
435 - wfDebug("OpenID: Error adding new user.\n");
 433+ if ( !$user->getId() ) {
 434+ wfDebug( "OpenID: Error adding new user.\n" );
436435 } else {
437436
438 - $this->insertUserUrl($user, $openid);
 437+ $this->insertUserUrl( $user, $openid );
439438
440 - if (array_key_exists('nickname', $sreg)) {
441 - $user->setOption('nickname', $sreg['nickname']);
 439+ if ( array_key_exists( 'nickname', $sreg ) ) {
 440+ $user->setOption( 'nickname', $sreg['nickname'] );
442441 }
443 - if (array_key_exists('email', $sreg)) {
 442+ if ( array_key_exists( 'email', $sreg ) ) {
444443 $user->setEmail( $sreg['email'] );
445444 }
446 - if ($wgAllowRealName && array_key_exists('fullname', $sreg)) {
447 - $user->setRealName($sreg['fullname']);
 445+ if ( $wgAllowRealName && array_key_exists( 'fullname', $sreg ) ) {
 446+ $user->setRealName( $sreg['fullname'] );
448447 }
449 - if (array_key_exists('language', $sreg)) {
 448+ if ( array_key_exists( 'language', $sreg ) ) {
450449 # FIXME: check and make sure the language exists
451 - $user->setOption('language', $sreg['language']);
 450+ $user->setOption( 'language', $sreg['language'] );
452451 }
453 - if (array_key_exists('timezone', $sreg)) {
 452+ if ( array_key_exists( 'timezone', $sreg ) ) {
454453 # FIXME: do something with it.
455454 # $offset = OpenIDTimezoneToTzoffset($sreg['timezone']);
456455 # $user->setOption('timecorrection', $offset);
@@ -459,20 +458,20 @@
460459 }
461460 }
462461
463 - function createName($openid, $sreg) {
 462+ function createName( $openid, $sreg ) {
464463
465 - if (array_key_exists('nickname', $sreg) && # try nickname
466 - $this->userNameOK($sreg['nickname']))
 464+ if ( array_key_exists( 'nickname', $sreg ) && # try nickname
 465+ $this->userNameOK( $sreg['nickname'] ) )
467466 {
468467 return $sreg['nickname'];
469468 }
470469 }
471470
472 - function toUserName($openid) {
473 - if (Auth_Yadis_identifierScheme($openid) == 'XRI') {
474 - return $this->toUserNameXri($openid);
 471+ function toUserName( $openid ) {
 472+ if ( Auth_Yadis_identifierScheme( $openid ) == 'XRI' ) {
 473+ return $this->toUserNameXri( $openid );
475474 } else {
476 - return $this->toUserNameUrl($openid);
 475+ return $this->toUserNameUrl( $openid );
477476 }
478477 }
479478
@@ -481,15 +480,15 @@
482481 # 2. One element in path, like http://profile.typekey.com/EvanProdromou/
483482 # or http://getopenid.com/evanprodromou
484483
485 - function toUserNameUrl($openid) {
486 - static $bad = array('query', 'user', 'password', 'port', 'fragment');
 484+ function toUserNameUrl( $openid ) {
 485+ static $bad = array( 'query', 'user', 'password', 'port', 'fragment' );
487486
488 - $parts = parse_url($openid);
 487+ $parts = parse_url( $openid );
489488
490489 # If any of these parts exist, this won't work
491490
492 - foreach ($bad as $badpart) {
493 - if (array_key_exists($badpart, $parts)) {
 491+ foreach ( $bad as $badpart ) {
 492+ if ( array_key_exists( $badpart, $parts ) ) {
494493 return NULL;
495494 }
496495 }
@@ -497,16 +496,16 @@
498497 # We just have host and/or path
499498
500499 # If it's just a host...
501 - if (array_key_exists('host', $parts) &&
502 - (!array_key_exists('path', $parts) || strcmp($parts['path'], '/') == 0))
 500+ if ( array_key_exists( 'host', $parts ) &&
 501+ ( !array_key_exists( 'path', $parts ) || strcmp( $parts['path'], '/' ) == 0 ) )
503502 {
504 - $hostparts = explode('.', $parts['host']);
 503+ $hostparts = explode( '.', $parts['host'] );
505504
506505 # Try to catch common idiom of nickname.service.tld
507506
508 - if ((count($hostparts) > 2) &&
509 - (strlen($hostparts[count($hostparts) - 2]) > 3) && # try to skip .co.uk, .com.au
510 - (strcmp($hostparts[0], 'www') != 0))
 507+ if ( ( count( $hostparts ) > 2 ) &&
 508+ ( strlen( $hostparts[count( $hostparts ) - 2] ) > 3 ) && # try to skip .co.uk, .com.au
 509+ ( strcmp( $hostparts[0], 'www' ) != 0 ) )
511510 {
512511 return $hostparts[0];
513512 } else {
@@ -514,11 +513,11 @@
515514 return $parts['host'];
516515 }
517516 } else {
518 - if (array_key_exists('path', $parts)) {
 517+ if ( array_key_exists( 'path', $parts ) ) {
519518 # Strip starting, ending slashes
520 - $path = preg_replace('@/$@', '', $parts['path']);
521 - $path = preg_replace('@^/@', '', $path);
522 - if (strpos($path, '/') === false) {
 519+ $path = preg_replace( '@/$@', '', $parts['path'] );
 520+ $path = preg_replace( '@^/@', '', $path );
 521+ if ( strpos( $path, '/' ) === false ) {
523522 return $path;
524523 }
525524 }
@@ -527,33 +526,33 @@
528527 return NULL;
529528 }
530529
531 - function toUserNameXri($xri) {
532 - $base = $this->xriBase($xri);
 530+ function toUserNameXri( $xri ) {
 531+ $base = $this->xriBase( $xri );
533532
534 - if (!$base) {
 533+ if ( !$base ) {
535534 return NULL;
536535 } else {
537536 # =evan.prodromou
538537 # or @gratis*evan.prodromou
539 - $parts = explode('*', substr($base, 1));
540 - return array_pop($parts);
 538+ $parts = explode( '*', substr( $base, 1 ) );
 539+ return array_pop( $parts );
541540 }
542541 }
543542
544543 # Is this name OK to use as a user name?
545544
546 - function userNameOK($name) {
 545+ function userNameOK( $name ) {
547546 global $wgReservedUsernames;
548 - return (0 == User::idFromName($name) &&
549 - !in_array( $name, $wgReservedUsernames ));
 547+ return ( 0 == User::idFromName( $name ) &&
 548+ !in_array( $name, $wgReservedUsernames ) );
550549 }
551550
552551 # Get an auto-incremented name
553552
554 - function firstAvailable($prefix) {
555 - for ($i = 2; ; $i++) { # FIXME: this is the DUMB WAY to do this
 553+ function firstAvailable( $prefix ) {
 554+ for ( $i = 2; ; $i++ ) { # FIXME: this is the DUMB WAY to do this
556555 $name = "$prefix$i";
557 - if ($this->userNameOK($name)) {
 556+ if ( $this->userNameOK( $name ) ) {
558557 return $name;
559558 }
560559 }
@@ -600,10 +599,10 @@
601600 return $openid_url;
602601 }
603602
604 - function saveValues($openid, $sreg) {
 603+ function saveValues( $openid, $sreg ) {
605604 global $wgSessionStarted, $wgUser;
606605
607 - if (!$wgSessionStarted) {
 606+ if ( !$wgSessionStarted ) {
608607 $wgUser->SetupSession();
609608 }
610609
@@ -627,11 +626,11 @@
628627 return $_SESSION['openid_consumer_returnto'];
629628 }
630629
631 - function setReturnTo($returnto) {
 630+ function setReturnTo( $returnto ) {
632631 $_SESSION['openid_consumer_returnto'] = $returnto;
633632 }
634633
635 - function getUserName($openid, $sreg, $choice, $nameValue) {
 634+ function getUserName( $openid, $sreg, $choice, $nameValue ) {
636635 switch ( $choice ) {
637636 case 'full':
638637 return ( ( array_key_exists( 'fullname', $sreg ) ) ? $sreg['fullname'] : null );
@@ -651,13 +650,13 @@
652651
653652 function automaticName( $sreg ) {
654653 if ( array_key_exists( 'nickname', $sreg ) && # try auto-generated from nickname
655 - strlen( $sreg['nickname']) > 0 ) {
 654+ strlen( $sreg['nickname'] ) > 0 ) {
656655 return $this->firstAvailable( $sreg['nickname'] );
657656 } else { # try auto-generated
658657 return $this->firstAvailable( wfMsg( 'openidusernameprefix' ) );
659658 }
660659 }
661 -
 660+
662661 function attachUser( $openid, $sreg, $name, $password ) {
663662
664663 $user = User::newFromName( $name );
@@ -665,13 +664,13 @@
666665 if ( !$user ) {
667666 return NULL;
668667 }
669 -
 668+
670669 if ( !$user->checkPassword( $password ) ) {
671670 return NULL;
672671 }
673 -
 672+
674673 $this->setUserUrl( $user, $openid );
675 -
 674+
676675 return $user;
677676 }
678677 }
Index: trunk/extensions/OpenID/SpecialOpenIDXRDS.body.php
@@ -22,8 +22,8 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI'))
27 - exit(1);
 26+if ( !defined( 'MEDIAWIKI' ) )
 27+ exit( 1 );
2828
2929 # Outputs a Yadis (http://yadis.org/) XRDS file, saying that this server
3030 # supports OpenID and lots of other jazz.
@@ -31,85 +31,85 @@
3232 class SpecialOpenIDXRDS extends SpecialOpenID {
3333
3434 function SpecialOpenIDXRDS() {
35 - SpecialPage::SpecialPage("OpenIDXRDS", '', false);
 35+ SpecialPage::SpecialPage( "OpenIDXRDS", '', false );
3636 }
3737
3838 # $par is a user name
3939
40 - function execute($par) {
 40+ function execute( $par ) {
4141 global $wgOut, $wgOpenIDClientOnly;
4242
4343 wfLoadExtensionMessages( 'OpenID' );
44 -
 44+
4545 # No server functionality if this site is only a client
4646 # Note: special page is un-registered if this flag is set,
4747 # so it'd be unusual to get here.
48 -
49 - if ($wgOpenIDClientOnly) {
50 - wfHttpError(404, "Not Found", wfMsg('openidclientonlytext'));
 48+
 49+ if ( $wgOpenIDClientOnly ) {
 50+ wfHttpError( 404, "Not Found", wfMsg( 'openidclientonlytext' ) );
5151 return;
5252 }
5353
5454 // XRDS preamble XML.
55 - $xml_template = array('<?xml version="1.0" encoding="UTF-8"?>',
56 - '<xrds:XRDS',
57 - ' xmlns:xrds="xri://\$xrds"',
58 - ' xmlns:openid="http://openid.net/xmlns/1.0"',
59 - ' xmlns="xri://$xrd*($v*2.0)">',
60 - '<XRD>');
 55+ $xml_template = array( '<?xml version="1.0" encoding="UTF-8"?>',
 56+ '<xrds:XRDS',
 57+ ' xmlns:xrds="xri://\$xrds"',
 58+ ' xmlns:openid="http://openid.net/xmlns/1.0"',
 59+ ' xmlns="xri://$xrd*($v*2.0)">',
 60+ '<XRD>' );
6161
6262 # Check to see if the parameter is really a user name
6363
64 - if (!$par) {
65 - wfHttpError(404, "Not Found", wfMsg('openidnousername'));
 64+ if ( !$par ) {
 65+ wfHttpError( 404, "Not Found", wfMsg( 'openidnousername' ) );
6666 }
6767
68 - $user = User::newFromName($par);
 68+ $user = User::newFromName( $par );
6969
70 - if (!$user || $user->getID() == 0) {
71 - wfHttpError(404, "Not Found", wfMsg('openidbadusername'));
 70+ if ( !$user || $user->getID() == 0 ) {
 71+ wfHttpError( 404, "Not Found", wfMsg( 'openidbadusername' ) );
7272 }
7373
7474 // Generate the user page URL.
7575
76 - $user_title = Title::makeTitle(NS_USER, $user->getName());
 76+ $user_title = Title::makeTitle( NS_USER, $user->getName() );
7777 $user_url = $user_title->getFullURL();
7878
7979 // Generate the OpenID server endpoint URL.
80 - $server_title = Title::makeTitle(NS_SPECIAL, 'OpenIDServer');
 80+ $server_title = Title::makeTitle( NS_SPECIAL, 'OpenIDServer' );
8181 $server_url = $server_title->getFullURL();
8282
8383 // Define array of Yadis services to be included in
8484 // the XRDS output.
8585 $services = array(
86 - array('uri' => $server_url,
 86+ array( 'uri' => $server_url,
8787 'priority' => '0',
88 - 'types' => array('http://openid.net/signon/1.0',
 88+ 'types' => array( 'http://openid.net/signon/1.0',
8989 'http://openid.net/sreg/1.0',
90 - 'http://specs.openid.net/auth/2.0/signon'),
91 - 'delegate' => $user_url),
 90+ 'http://specs.openid.net/auth/2.0/signon' ),
 91+ 'delegate' => $user_url ),
9292 );
9393
9494 // Generate <Service> elements into $service_text.
9595 $service_text = "\n";
96 - foreach ($services as $service) {
97 - $types = array();
98 - foreach ($service['types'] as $type_uri) {
99 - $types[] = ' <Type>'.$type_uri.'</Type>';
100 - }
101 - $service_text .= implode("\n",
102 - array(' <Service priority="'.$service['priority'].'">',
103 - ' <URI>'.$server_url.'</URI>',
104 - implode("\n", $types),
105 - ' </Service>'));
 96+ foreach ( $services as $service ) {
 97+ $types = array();
 98+ foreach ( $service['types'] as $type_uri ) {
 99+ $types[] = ' <Type>' . $type_uri . '</Type>';
 100+ }
 101+ $service_text .= implode( "\n",
 102+ array( ' <Service priority="' . $service['priority'] . '">',
 103+ ' <URI>' . $server_url . '</URI>',
 104+ implode( "\n", $types ),
 105+ ' </Service>' ) );
106106 }
107107
108108 $wgOut->disable();
109109
110110 // Print content-type and XRDS XML.
111 - header("Content-Type: application/xrds+xml");
112 - print implode("\n", $xml_template);
 111+ header( "Content-Type: application/xrds+xml" );
 112+ print implode( "\n", $xml_template );
113113 print $service_text;
114 - print implode("\n", array("</XRD>", "</xrds:XRDS>"));
 114+ print implode( "\n", array( "</XRD>", "</xrds:XRDS>" ) );
115115 }
116116 }
\ No newline at end of file
Index: trunk/extensions/OpenID/OpenID.setup.php
@@ -22,11 +22,11 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -if (!defined('MEDIAWIKI')) {
 26+if ( !defined( 'MEDIAWIKI' ) ) {
2727 exit( 1 );
2828 }
2929
30 -define('MEDIAWIKI_OPENID_VERSION', '0.8.4.1');
 30+define( 'MEDIAWIKI_OPENID_VERSION', '0.8.4.1' );
3131
3232 # CONFIGURATION VARIABLES
3333
@@ -34,7 +34,7 @@
3535
3636 $wgHideOpenIDLoginLink = false;
3737
38 -# Location of the OpenID login logo. You can copy this to your server if you want.
 38+# Location of the OpenID login logo. You can copy this to your server if you want.
3939 $wgOpenIDLoginLogoUrl = $wgScriptPath . '/extensions/OpenID/skin/icons/openid-inputicon.png';
4040
4141 # Whether to show the OpenID identity URL on a user's home page. Possible values are 'always', 'never', or 'user'
@@ -158,5 +158,5 @@
159159 $wgHooks['InitPreferencesForm'][] = 'OpenIDHooks::onInitPreferencesForm';
160160 $wgHooks['ResetPreferences'][] = 'OpenIDHooks::onResetPreferences';
161161 $wgHooks['SavePreferences'][] = 'OpenIDHooks::onSavePreferences';
162 -#Fixme, function does not exist
163 -#$wgHooks['UserLoginForm'][] = 'OpenIDHooks::onUserLoginForm';
 162+# FIXME, function does not exist
 163+# $wgHooks['UserLoginForm'][] = 'OpenIDHooks::onUserLoginForm';
Index: trunk/extensions/OpenID/OpenID.php
@@ -1,3 +1,3 @@
22 <?php
33 # backwards compatibility; new sites should require OpenID.setup.php
4 -require_once(dirname(__FILE__) . '/OpenID.setup.php');
 4+require_once( dirname( __FILE__ ) . '/OpenID.setup.php' );
Index: trunk/extensions/OpenID/TODO
@@ -62,4 +62,3 @@
6363 - Dynamic HTML swap in of OpenID login form on Special:Userlogin
6464 - warn if a user account has been used as a login before attaching an
6565 OpenID
66 -
\ No newline at end of file
Index: trunk/extensions/OpenID/optionToTable.php
@@ -22,28 +22,28 @@
2323 * @addtogroup Extensions
2424 */
2525
26 -require_once('commandLine.inc');
27 -ini_set( "include_path", "/usr/share/php:" . ini_get("include_path"));
 26+require_once( 'commandLine.inc' );
 27+ini_set( "include_path", "/usr/share/php:" . ini_get( "include_path" ) );
2828
29 -require_once("$IP/extensions/OpenID/Consumer.php");
 29+require_once( "$IP/extensions/OpenID/Consumer.php" );
3030
3131 global $wgSharedDB, $wgDBprefix;
3232 $tableName = "${wgDBprefix}user_openid";
33 -if (isset($wgSharedDB)) {
 33+if ( isset( $wgSharedDB ) ) {
3434 $tableName = "`$wgSharedDB`.$tableName";
3535 }
3636
3737 $dbr =& wfGetDB( DB_SLAVE );
3838
39 -$res = $dbr->select(array('user'),
40 - array('user_name'),
41 - array('user_options LIKE "%openid_url%"'),
 39+$res = $dbr->select( array( 'user' ),
 40+ array( 'user_name' ),
 41+ array( 'user_options LIKE "%openid_url%"' ),
4242 'optionToTable',
43 - array('ORDER BY' => 'user_name'));
 43+ array( 'ORDER BY' => 'user_name' ) );
4444
45 -while ($res && $row = $dbr->fetchObject($res)) {
46 - $user = User::newFromName($row->user_name);
47 - print( $user->getName() . ": " . $user->getOption('openid_url') . "\n");
48 - OpenIDSetUserUrl($user, $user->getOption('openid_url'));
 45+while ( $res && $row = $dbr->fetchObject( $res ) ) {
 46+ $user = User::newFromName( $row->user_name );
 47+ print( $user->getName() . ": " . $user->getOption( 'openid_url' ) . "\n" );
 48+ OpenIDSetUserUrl( $user, $user->getOption( 'openid_url' ) );
4949 }
50 -$dbr->freeResult($res);
 50+$dbr->freeResult( $res );
Index: trunk/extensions/OpenID/OpenIDProvider.body.php
@@ -1,6 +1,6 @@
22 <?
3 -if (!defined('MEDIAWIKI'))
4 - exit(1);
 3+if ( !defined( 'MEDIAWIKI' ) )
 4+ exit( 1 );
55
66 class OpenIDProvider {
77 var $id;
@@ -8,50 +8,50 @@
99 var $label;
1010 var $url;
1111
12 - function OpenIDProvider($id, $name, $label, $url) {
 12+ function OpenIDProvider( $id, $name, $label, $url ) {
1313 $this->id = $id;
1414 $this->name = $name;
1515 $this->label = $label;
1616 $this->url = $url;
1717 }
1818
19 - function getButtonHTML($isLarge) {
 19+ function getButtonHTML( $isLarge ) {
2020 global $wgOpenIDShowProviderIcons, $wgOpenIDIconPath;
2121
22 - if ($wgOpenIDShowProviderIcons)
 22+ if ( $wgOpenIDShowProviderIcons )
2323 {
2424 return '<a id="openid_provider_' . $this->id . '_icon" title="' . $this->name . '"' .
2525 ' href="javascript: openid.show(\'' . $this->id . '\');"' .
26 - ' class="openid_' . ($isLarge ? 'large' : 'small') . '_btn' .
27 - ($this->id == 'openid' ? ' openid_selected' : '') . '"></a>';
 26+ ' class="openid_' . ( $isLarge ? 'large' : 'small' ) . '_btn' .
 27+ ( $this->id == 'openid' ? ' openid_selected' : '' ) . '"></a>';
2828 }
2929 else
3030 {
3131 return '<a id="openid_provider_' . $this->id . '_link" title="' . $this->name . '"' .
3232 ' href="javascript: openid.show(\'' . $this->id . '\');"' .
33 - ' class="openid_'.($isLarge ? 'large' : 'small') . '_link' .
34 - ($this->id == 'openid' ? ' openid_selected' : '') . '">' . $this->name . '</a>';
 33+ ' class="openid_' . ( $isLarge ? 'large' : 'small' ) . '_link' .
 34+ ( $this->id == 'openid' ? ' openid_selected' : '' ) . '">' . $this->name . '</a>';
3535 }
3636 }
37 - function getLargeButtonHTML() { return $this->getButtonHTML(true); }
38 - function getSmallButtonHTML() { return $this->getButtonHTML(false); }
 37+ function getLargeButtonHTML() { return $this->getButtonHTML( true ); }
 38+ function getSmallButtonHTML() { return $this->getButtonHTML( false ); }
3939
4040 function getLoginFormHTML() {
4141 $html = '<div id="provider_form_' . $this->id . '"' .
42 - ($this->id == 'openid' ? '' : ' style="display:none"') . '>' .
 42+ ( $this->id == 'openid' ? '' : ' style="display:none"' ) . '>' .
4343 '<div><label for="openid_url">' . $this->label . '</label></div>';
4444
45 - if ($this->id == 'openid') {
 45+ if ( $this->id == 'openid' ) {
4646 $html .= '<input type="text" name="openid_url" id="openid_url" size="50" value="" />';
47 - $html .= '<input type="submit" value="' . wfMsg('login') . '"/>';
 47+ $html .= '<input type="submit" value="' . wfMsg( 'login' ) . '"/>';
4848 } else {
49 - $html .= '<input type="hidden" id="openid_provider_url_'.$this->id.'" value="'.$this->url.'" />';
50 - if (strpos($this->url, '{') === false) {
51 - $html .= '<input type="hidden" id="openid_provider_param_'.$this->id.'" size="25" value="" />';
 49+ $html .= '<input type="hidden" id="openid_provider_url_' . $this->id . '" value="' . $this->url . '" />';
 50+ if ( strpos( $this->url, '{' ) === false ) {
 51+ $html .= '<input type="hidden" id="openid_provider_param_' . $this->id . '" size="25" value="" />';
5252 } else {
53 - $html .= '<input type="text" id="openid_provider_param_'.$this->id.'" size="25" value="" />';
 53+ $html .= '<input type="text" id="openid_provider_param_' . $this->id . '" size="25" value="" />';
5454 }
55 - $html .= '<input type="submit" value="' . wfMsg('login') . '"/>';
 55+ $html .= '<input type="submit" value="' . wfMsg( 'login' ) . '"/>';
5656 }
5757 $html .= '</div>';
5858
@@ -61,35 +61,35 @@
6262 # large ones
6363 static function getLargeProviders() {
6464 return array(
65 - new self('openid', 'OpenID', wfMsg('openid-provider-label-openid'), '{URL}'),
66 - new self('google', 'Google', wfMsg('openid-provider-label-google'), 'https://www.google.com/accounts/o8/id'),
67 - new self('yahoo', 'Yahoo', wfMsg('openid-provider-label-yahoo'), 'http://yahoo.com/'),
68 - new self('aol', 'AOL', wfMsg('openid-provider-label-aol'), 'http://openid.aol.com/{username}')
 65+ new self( 'openid', 'OpenID', wfMsg( 'openid-provider-label-openid' ), '{URL}' ),
 66+ new self( 'google', 'Google', wfMsg( 'openid-provider-label-google' ), 'https://www.google.com/accounts/o8/id' ),
 67+ new self( 'yahoo', 'Yahoo', wfMsg( 'openid-provider-label-yahoo' ), 'http://yahoo.com/' ),
 68+ new self( 'aol', 'AOL', wfMsg( 'openid-provider-label-aol' ), 'http://openid.aol.com/{username}' )
6969 );
7070 }
7171
7272 # smaller ones
7373 static function getSmallProviders() {
7474 return array(
75 - new self('myopenid', 'MyOpenID', wfMsg('openid-provider-label-other-username', 'MyOpenID'),
76 - 'http://{username}.myopenid.com/'),
77 - new self('livejournal', 'LiveJournal', wfMsg('openid-provider-label-other-username', 'LiveJournal'),
78 - 'http://{username}.livejournal.com/'),
79 - new self('vox', 'VOX', wfMsg('openid-provider-label-other-username', 'VOX'),
80 - 'http://{username}.vox.com/'),
 75+ new self( 'myopenid', 'MyOpenID', wfMsg( 'openid-provider-label-other-username', 'MyOpenID' ),
 76+ 'http://{username}.myopenid.com/' ),
 77+ new self( 'livejournal', 'LiveJournal', wfMsg( 'openid-provider-label-other-username', 'LiveJournal' ),
 78+ 'http://{username}.livejournal.com/' ),
 79+ new self( 'vox', 'VOX', wfMsg( 'openid-provider-label-other-username', 'VOX' ),
 80+ 'http://{username}.vox.com/' ),
8181 # wordpress.com doesn't work for some reason
8282 # new self('wordpress', 'Wordpress.com', wfMsg('openid-provider-label-other-username', 'Wordpress.com'),
8383 # 'http://{username}.wordpress.com/'),
84 - new self('blogger', 'Bloggger', wfMsg('openid-provider-label-other-username', 'Bloggger'),
85 - 'http://{username}.blogspot.com/'),
86 - new self('flickr', 'Flickr', wfMsg('openid-provider-label-other-username', 'Flickr'),
87 - 'http://flickr.com/photos/{username}/'),
88 - new self('verisign', 'Verisign', wfMsg('openid-provider-label-other-username', 'Verisign'),
89 - 'http://{username}.pip.verisignlabs.com/'),
90 - new self('vidoop', 'Vidoop', wfMsg('openid-provider-label-other-username', 'Vidoop'),
91 - 'http://{username}.myvidoop.com/'),
92 - new self('claimid', 'ClaimID', wfMsg('openid-provider-label-other-username', 'ClaimID'),
93 - 'http://claimid.com/{username}')
 84+ new self( 'blogger', 'Bloggger', wfMsg( 'openid-provider-label-other-username', 'Bloggger' ),
 85+ 'http://{username}.blogspot.com/' ),
 86+ new self( 'flickr', 'Flickr', wfMsg( 'openid-provider-label-other-username', 'Flickr' ),
 87+ 'http://flickr.com/photos/{username}/' ),
 88+ new self( 'verisign', 'Verisign', wfMsg( 'openid-provider-label-other-username', 'Verisign' ),
 89+ 'http://{username}.pip.verisignlabs.com/' ),
 90+ new self( 'vidoop', 'Vidoop', wfMsg( 'openid-provider-label-other-username', 'Vidoop' ),
 91+ 'http://{username}.myvidoop.com/' ),
 92+ new self( 'claimid', 'ClaimID', wfMsg( 'openid-provider-label-other-username', 'ClaimID' ),
 93+ 'http://claimid.com/{username}' )
9494 );
9595 }
9696 }

Status & tagging log