r42581 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42580‎ | r42581 | r42582 >
Date:21:59, 25 October 2008
Author:siebrand
Status:old
Tags:
Comment:
Updates for NssMySQLAuth
* reduce dirname() calls
* add localisation for special page name
* add localisation for 1 message
* add extension credits
* update messages
* update indentation and remove trailing whitespace
* add support to Translate
Modified paths:
  • /trunk/extensions/NssMySQLAuth/Md5crypt.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/NssMySQLAuth.alias.php (added) (history)
  • /trunk/extensions/NssMySQLAuth/NssMySQLAuth.i18n.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/NssMySQLAuth.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/NssMySQLAuthPlugin.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/SpecialAccountManager.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/libnss-mysql.cfg (modified) (history)
  • /trunk/extensions/NssMySQLAuth/migrateUser.php (modified) (history)
  • /trunk/extensions/NssMySQLAuth/tables.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/NssMySQLAuth/NssMySQLAuth.i18n.php
@@ -1,14 +1,23 @@
22 <?php
 3+/*
 4+ * Internationalization for NssMySQLAuth extension.
 5+ */
36
47 $messages = array();
58
 9+/**
 10+ * English
 11+ * @author Bryan Tong Minh
 12+ */
613 $messages['en'] = array(
714 'accountmanager' => 'Account manager',
815
916 'am-username' => 'username',
10 - 'am-email' => 'email',
 17+ 'am-email' => 'e-mail',
1118 'am-active' => 'active',
12 -
 19+ 'am-updated' => 'Your changes have been saved successfully',
 20+
 21+ 'nss-desc' => 'A plugin to authenticate against a libnss-mysql database. Contains an [[Special:AccountManager|account manager]]',
1322 'nss-save-changes' => 'Save changes',
1423 'nss-create-account-header' => 'Create new account',
1524 'nss-create-account' => 'Create account',
Index: trunk/extensions/NssMySQLAuth/NssMySQLAuthPlugin.php
@@ -14,14 +14,14 @@
1515 global $wgAuth, $wgHooks;
1616 global $wgNssMySQLAuthDB;
1717 $wgAuth = new self( $wgNssMySQLAuthDB );
18 -
 18+
1919 $wgHooks['UserEffectiveGroups'][] = array( $wgAuth, 'onUserEffectiveGroups' );
2020 $wgHooks['UserGetEmail'][] = array( $wgAuth, 'onUserGetEmail' );
2121 $wgHooks['UserSetEmail'][] = array( $wgAuth, 'onUserSetEmail' );
22 -
 22+
2323 wfLoadExtensionMessages( 'nssmysqlauth' );
2424 }
25 -
 25+
2626 function __construct( $wikiName = false ) {
2727 $this->wikiName = $wikiName;
2828 $this->users = array();
@@ -30,22 +30,22 @@
3131 function getDB( $db = DB_LAST ) {
3232 return wfGetDB( $db, array(), $this->wikiName );
3333 }
34 -
 34+
3535 function userExists( $username ) {
3636 if( isset( $this->users[$username] ))
3737 return $this->users[$username];
3838
3939 $dbr = $this->getDB( DB_READ );
40 - return $this->users[$username] =
41 - false !== $dbr->select(
 40+ return $this->users[$username] =
 41+ false !== $dbr->select(
4242 'passwd', 1, array( 'pwd_name' => $username ),
4343 __METHOD__
4444 );
4545 }
46 -
 46+
4747 function authenticate( $username, $password ) {
4848 $dbr = $this->getDB( DB_READ );
49 - $res = $dbr->selectRow(
 49+ $res = $dbr->selectRow(
5050 'passwd',
5151 array( 'pwd_name', 'pwd_password' ),
5252 array( 'pwd_name' => $username ),
@@ -56,56 +56,56 @@
5757 return Md5crypt::encryptPassword( $password, $res->pwd_password )
5858 == $res->pwd_password;
5959 }
60 -
 60+
6161 function updateUser( &$user ) {
6262 $dbr = $this->getDB( DB_READ );
6363 $res = $dbr->selectRow(
64 - 'passwd',
 64+ 'passwd',
6565 array( 'pwd_email' ),
6666 array( 'pwd_name' => $user->getName() ),
6767 __METHOD__
6868 );
69 -
 69+
7070 if( $res === false ) return true;
71 -
72 - $user->setEmail( $res->pwd_email );
 71+
 72+ $user->setEmail( $res->pwd_email );
7373 return true;
7474 }
75 -
 75+
7676 function autoCreate() {
7777 return true;
7878 }
7979 function setPassword( $user, $password ) {
8080 $encryptedPassword = Md5crypt::encryptPassword( $password );
8181 $dbw = $this->getDB( DB_WRITE );
82 - return true == $dbw->update(
83 - 'passwd',
84 - array(
 82+ return true == $dbw->update(
 83+ 'passwd',
 84+ array(
8585 'pwd_password' => $encryptedPassword,
8686 'pwd_password_lastchange' => wfTimestamp( TS_UNIX ),
87 - ),
 87+ ),
8888 array( 'pwd_name' => $user->getName() ),
8989 __METHOD__
9090 );
9191 }
92 -
 92+
9393 function updateExternalDB( $user ) {
9494 // Email updated via hook
9595 return true;
9696 }
97 -
 97+
9898 function canCreateAccounts() {
9999 return false;
100100 }
101 -
 101+
102102 function addUser( $user, $password, $email='', $realname='' ) {
103103 return false;
104104 }
105 -
 105+
106106 function strict() {
107107 return false;
108108 }
109 -
 109+
110110 function onUserEffectiveGroups( &$user, &$groups ) {
111111 if( !$this->userExists( $user->getName() ) )
112112 return true;
@@ -119,68 +119,67 @@
120120 );
121121 while( $row = $res->fetchObject() )
122122 $groups[] = $row->gm_group;
123 -
 123+
124124 return true;
125125 }
126 -
 126+
127127 function onUserGetEmail( $user, &$address ) {
128128 if( !$this->userExists( $user->getName() ) )
129129 return true;
130130
131131 $dbr = $this->getDB( DB_READ );
132 - $row = $dbr->selectRow( 'passwd' , 'pwd_email',
 132+ $row = $dbr->selectRow( 'passwd' , 'pwd_email',
133133 array( 'pwd_name' => $user->getName() ) );
134134 if( $row ) $address = $row->pwd_email;
135135 return true;
136136
137137 }
138 -
 138+
139139 function onUserSetEmail( $user, &$address ) {
140140 if( !$this->userExists( $user->getName() ) )
141141 return true;
142142
143143 $dbw = $this->getDB( DB_WRITE );
144144 return true == $dbw->update(
145 - 'passwd',
 145+ 'passwd',
146146 array( 'pwd_email' => $address ),
147147 array( 'pwd_name' => $user->getName() ),
148148 __METHOD__
149149 );
150150 }
151 -
 151+
152152 /**
153 - * Create an account, returning a random password
154 - */
155 - function createAccount( $username, $options ) {
156 - global $wgDefaultGid, $wgHomeDirectory;
157 - $password = User::randomPassword();
158 -
159 - $insert = array(
160 - 'pwd_name' => strtolower( $username ),
161 - 'pwd_password' => Md5crypt::encryptPassword( $password ),
162 - 'pwd_password_lastchange' => wfTimestamp( TS_UNIX ),
163 - 'pwd_gid' => $wgDefaultGid,
164 - 'pwd_home' => str_replace( '$1', strtolower( $username ), $wgHomeDirectory )
165 - );
166 -
167 - // $options is something that is passed to user_props
168 - $insert['pwd_email'] = $options['email'];
169 - $insert['pwd_active'] = $options['active'];
170 -
171 - // Guess a nice uid. We actually need a lock here
172 - $dbw = $this->getDB( DB_MASTER );
173 - $row = $dbw->selectRow( 'passwd', 'MAX(pwd_uid) + 1 AS uid', array(), __METHOD__ );
174 - $uid = $row->uid;
175 - if ( function_exists( 'posix_getpwuid' ) ) {
176 - while( posix_getpwuid( $uid ) )
177 - $uid++;
178 - }
179 -
180 - $insert['pwd_uid'] = $uid;
181 -
182 - $dbw->insert( 'passwd', $insert, __METHOD__ );
183 -
184 - return $password;
185 - }
 153+ * Create an account, returning a random password
 154+ */
 155+ function createAccount( $username, $options ) {
 156+ global $wgDefaultGid, $wgHomeDirectory;
 157+ $password = User::randomPassword();
186158
 159+ $insert = array(
 160+ 'pwd_name' => strtolower( $username ),
 161+ 'pwd_password' => Md5crypt::encryptPassword( $password ),
 162+ 'pwd_password_lastchange' => wfTimestamp( TS_UNIX ),
 163+ 'pwd_gid' => $wgDefaultGid,
 164+ 'pwd_home' => str_replace( '$1', strtolower( $username ), $wgHomeDirectory )
 165+ );
 166+
 167+ // $options is something that is passed to user_props
 168+ $insert['pwd_email'] = $options['email'];
 169+ $insert['pwd_active'] = $options['active'];
 170+
 171+ // Guess a nice uid. We actually need a lock here
 172+ $dbw = $this->getDB( DB_MASTER );
 173+ $row = $dbw->selectRow( 'passwd', 'MAX(pwd_uid) + 1 AS uid', array(), __METHOD__ );
 174+ $uid = $row->uid;
 175+ if ( function_exists( 'posix_getpwuid' ) ) {
 176+ while( posix_getpwuid( $uid ) )
 177+ $uid++;
 178+ }
 179+
 180+ $insert['pwd_uid'] = $uid;
 181+
 182+ $dbw->insert( 'passwd', $insert, __METHOD__ );
 183+
 184+ return $password;
 185+ }
187186 }
Index: trunk/extensions/NssMySQLAuth/NssMySQLAuth.php
@@ -8,28 +8,38 @@
99 * or any later version.
1010 *
1111 */
12 -
 12+
1313 ### READ BEFORE USING ###
14 - /*
15 - * This plugin allows authentication against an libnss-mysql database and thus
16 - * allows the use of the same login for MediaWiki as for shell.
17 - *
18 - */
19 -
 14+/*
 15+ * This plugin allows authentication against an libnss-mysql database and thus
 16+ * allows the use of the same login for MediaWiki as for shell.
 17+ *
 18+ */
2019
21 -$wgAutoloadClasses['NssMySQLAuthPlugin'] = dirname( __FILE__ ) . '/NssMySQLAuthPlugin.php';
22 -$wgAutoloadClasses['Md5crypt'] = dirname( __FILE__ ) . '/Md5crypt.php';
23 -$wgAutoloadClasses['SpecialAccountManager'] = dirname( __FILE__ ) . '/SpecialAccountManager.php';
 20+$wgExtensionCredits['other'][] = array(
 21+ 'name' => 'NssMySQLAuth',
 22+ 'version' => '1.0',
 23+ 'author' => 'Bryan Tong Minh',
 24+ 'description' => 'A plugin to authenticate against a libnss-mysql database. Contains an [[Special:AccountManager|account manager]]',
 25+ 'descriptionmsg' => 'nss-desc',
 26+ 'url' => 'http://www.mediawiki.org/wiki/Extension:NssMySQLAuth',
 27+);
 28+
 29+$dir = dirname( __FILE__ ) . '/';
 30+$wgExtensionMessagesFiles['nssmysqlauth'] = $dir . 'NssMySQLAuth.i18n.php';
 31+$wgExtensionAliasFiles['nssmysqlauth'] = $dir . 'NssMySQLAuth.alias.php';
 32+
 33+$wgAutoloadClasses['NssMySQLAuthPlugin'] = $dir . 'NssMySQLAuthPlugin.php';
 34+$wgAutoloadClasses['Md5crypt'] = $dir . 'Md5crypt.php';
 35+$wgAutoloadClasses['SpecialAccountManager'] = $dir . 'SpecialAccountManager.php';
2436 $wgSpecialPages['AccountManager'] = 'SpecialAccountManager';
2537
2638 $wgNssMySQLAuthDB = false;
2739
2840 $wgExtensionFunctions[] = array( 'NssMySQLAuthPlugin', 'initialize' );
2941
30 -$wgExtensionMessagesFiles['nssmysqlauth'] = dirname( __FILE__ ).'/NssMySQLAuth.i18n.php';
31 -
3242 $wgUserProperties = array( 'address', 'city' );
3343 $wgActivityModes = array( 'active', 'inactive' );
3444
3545 $wgDefaultGid = 1001;
36 -$wgHomeDirectory = '/home/$1';
\ No newline at end of file
 46+$wgHomeDirectory = '/home/$1';
Index: trunk/extensions/NssMySQLAuth/tables.sql
@@ -12,7 +12,7 @@
1313 pwd_shell varchar(255) default '/bin/sh',
1414 pwd_active varchar(15) default 1,
1515 pwd_email varchar(255) not null,
16 -
 16+
1717 PRIMARY KEY (pwd_uid),
1818 UNIQUE INDEX (pwd_name)
1919 ) character set ascii collate ascii_general_ci;
@@ -21,7 +21,7 @@
2222 grp_gid int not null,
2323 grp_name varchar(255),
2424 grp_password varchar(255) not null,
25 -
 25+
2626 PRIMARY KEY(grp_gid),
2727 INDEX (grp_name)
2828 ) character set ascii collate ascii_general_ci;
@@ -29,7 +29,7 @@
3030 CREATE TABLE group_membership (
3131 gm_user int not null,
3232 gm_group varchar(255),
33 -
 33+
3434 PRIMARY KEY (gm_user, gm_group),
3535 KEY (gm_group)
3636 ) character set ascii collate ascii_general_ci;
@@ -57,4 +57,3 @@
5858 GRANT SELECT (pwd_uid, pwd_name, pwd_gid, pwd_home, pwd_shell, pwd_active) ON nss_auth.passwd TO `nss-user`@`localhost`;
5959 GRANT SELECT ON nss_auth.groups TO `nss-user`@`localhost`;
6060 GRANT SELECT ON nss_auth.group_membership TO `nss-user`@`localhost`;
61 -
Index: trunk/extensions/NssMySQLAuth/NssMySQLAuth.alias.php
@@ -0,0 +1,13 @@
 2+<?php
 3+/**
 4+ * Aliases for special pages
 5+ */
 6+
 7+$aliases = array();
 8+
 9+/** English
 10+ * @author Bryan Tong Minh
 11+ */
 12+$aliases['en'] = array(
 13+ 'AccountManager' => array( 'AccountManager' ),
 14+);
Property changes on: trunk/extensions/NssMySQLAuth/NssMySQLAuth.alias.php
___________________________________________________________________
Added: svn:eol-style
115 + native
Added: svn:keywords
216 + Id
Index: trunk/extensions/NssMySQLAuth/libnss-mysql.cfg
@@ -8,9 +8,9 @@
99 getgrent SELECT grp_name, grp_password, grp_gid FROM groups
1010 memsbygid SELECT pwd_name FROM group_membership, groups, passwd WHERE gm_group = grp_name AND gm_user = pwd_uid AND grp_gid = '%1$u'
1111 gidsbymem SELECT grp_gid FROM group_membership, groups, passwd WHERE gm_group = grp_name AND gm_user = pwd_uid AND pwd_name = '%1$s'
12 -
13 -host localhost
14 -database nss_auth
15 -username nss-user
 12+
 13+host localhost
 14+database nss_auth
 15+username nss-user
1616 password publiclyviewablepassword
17 -socket /var/run/mysqld/mysqld.sock
 17+socket /var/run/mysqld/mysqld.sock
Index: trunk/extensions/NssMySQLAuth/Md5crypt.php
@@ -49,13 +49,13 @@
5050 */
5151
5252 class Md5crypt {
53 - private static $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
 53+ private static $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
5454
5555 static function to64($v, $n) {
5656 $ret = '';
57 -
 57+
5858 while(--$n >= 0) {
59 - $ret .= self::$itoa64{$v & 0x3f};
 59+ $ret .= self::$itoa64{$v & 0x3f};
6060 $v = $v >> 6;
6161 }
6262 return $ret;
@@ -73,29 +73,29 @@
7474 } else {
7575 $salt = '';
7676 mt_srand((double)(microtime() * 10000000));
77 -
 77+
7878 while(strlen($salt) < 8) {
7979 $salt .= self::$itoa64{mt_rand(0, strlen(self::$itoa64))};
8080 }
8181 }
82 -
 82+
8383 $ctx = $pw . $Magic . $salt;
84 -
 84+
8585 $final = pack('H*', md5($pw . $salt . $pw));
86 -
 86+
8787 for ($pl = strlen($pw); $pl > 0; $pl -= 16) {
8888 $ctx .= substr($final, 0, ($pl > 16) ? 16 : $pl);
8989 }
90 -
 90+
9191 // Now the 'weird' xform
92 - for($i = strlen($pw); $i; $i >>= 1) {
 92+ for($i = strlen($pw); $i; $i >>= 1) {
9393 if($i & 1) { // This comes from the original version,
94 - $ctx .= pack("C", 0); // where a memset() is done to $final
 94+ $ctx .= pack("C", 0); // where a memset() is done to $final
9595 } else { // before this loop
9696 $ctx .= $pw{0};
9797 }
9898 }
99 -
 99+
100100 $final = pack('H*', md5($ctx)); // The following is supposed to make
101101 // things run slower
102102
@@ -135,10 +135,10 @@
136136 |(intval(ord($final{9})) << 8)
137137 |(intval(ord($final{15}))), 4);
138138 $passwd .= self::to64((intval(ord($final{4}) << 16)
139 - |(intval(ord($final{10})) << 8)
 139+ |(intval(ord($final{10})) << 8)
140140 |(intval(ord($final{5})))), 4);
141141 $passwd .= self::to64((intval(ord($final{11}))), 2);
142 -
 142+
143143 // Return the final string
144144 return $Magic . $salt . '$' . $passwd;
145145 }
Index: trunk/extensions/NssMySQLAuth/migrateUser.php
@@ -25,7 +25,7 @@
2626 'pwd_email' => $email
2727 ), __METHOD__ ) )
2828 return false;
29 - if ( false == $dbw->insert( 'user_props', array(
 29+ if ( false == $dbw->insert( 'user_props', array(
3030 'up_timestamp' => $dbw->timestamp(),
3131 'up_user' => $username,
3232 'up_name' => 'email',
Index: trunk/extensions/NssMySQLAuth/SpecialAccountManager.php
@@ -5,7 +5,7 @@
66 parent::__construct( 'AccountManager', 'accountmanager', false );
77 $this->mErrors = array();
88 }
9 -
 9+
1010 function execute() {
1111 global $wgUser;
1212 if( !$this->userCanExecute( $wgUser ) )
@@ -18,16 +18,16 @@
1919 $this->showSuccess();
2020 if( $this->processCreateAccount() === true )
2121 $this->showSuccessCreate();
22 -
 22+
2323 $this->showErrors();
24 -
 24+
2525 $this->constructForm();
2626 $this->constructCreateForm();
2727 }
2828
2929 function showSuccess() {
3030 global $wgOut;
31 - $wgOut->addHTML( Xml::element('p', array(), 'Your changes have been successfully updated' ) );
 31+ $wgOut->addHTML( Xml::element('p', array(), wfMsg( 'am-updated' ) ) );
3232 }
3333 function showSuccessCreate() {
3434 return $this->showSuccess();
@@ -49,7 +49,7 @@
5050 "</th><th>".wfMsgHtml( 'am-active' )."</th>");
5151 foreach( $wgUserProperties as $i ) {
5252 $msg = 'am-'.$i;
53 - $wgOut->addHTML( Xml::element( 'th', null,
 53+ $wgOut->addHTML( Xml::element( 'th', null,
5454 wfEmptyMsg( $msg, wfMsg( $msg ) ) ? $i : wfMsgHtml( $msg ) ) );
5555 }
5656 $wgOut->addHTML("</tr>\n\n");
@@ -68,14 +68,14 @@
6969 $props = $user->getProps();
7070 foreach( $wgUserProperties as $key ) {
7171 $value = isset( $props[$key] ) ? $props[$key] : '';
72 - $row .= "<td>".Xml::input(
 72+ $row .= "<td>".Xml::input(
7373 "am-{$name}-{$key}", 40, $value
7474 )."</td>";
7575 }
7676 $row .= "</tr>\n";
7777 $wgOut->addHTML( $row );
7878 }
79 -
 79+
8080 $wgOut->addHTML( "</table>\n" );
8181 $wgOut->addHTML( "<div id=\"userprops-submit\">\n".
8282 Xml::hidden( 'action', 'submit' ).
@@ -83,10 +83,10 @@
8484 'type' => 'submit',
8585 'value' => wfMsg( 'nss-save-changes' )
8686 ) ).
87 - "</div>\n</form>"
 87+ "</div>\n</form>"
8888 );
8989 }
90 -
 90+
9191 function constructCreateForm() {
9292 global $wgOut, $wgScript;
9393 global $wgUserProperties, $wgActivityModes;
@@ -95,11 +95,11 @@
9696 'action' => $this->getTitle()->getLocalURL(),
9797 'method' => 'post' )
9898 ) );
99 -
 99+
100100 $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'nss-create-account-header' ) )."\n" );
101101
102102 $wgOut->addHTML( "<table border=\"1\" id=\"newuser\">\n" );
103 -
 103+
104104 $props = array_merge( array( 'username', 'email' ), $wgUserProperties );
105105 foreach( $props as $i ) {
106106 $msg = 'am-'.$i;
@@ -109,7 +109,7 @@
110110 "</td></tr>\n"
111111 );
112112 }
113 -
 113+
114114 global $wgActivityModes;
115115 $select = new XmlSelect( "am-active" );
116116 $select->setDefault( 'active' );
@@ -118,7 +118,7 @@
119119 $select->addOption( $key );
120120 $wgOut->addHTML( "\t<tr><th>".wfMsgHtml( 'am-active' ).
121121 "</th><td>".$select->getHTML()."</td></tr>\n" );
122 -
 122+
123123 $wgOut->addHTML( "</table>\n" );
124124 $wgOut->addHTML( "<div id=\"newaccount-submit\">\n".
125125 Xml::hidden( 'action', 'create' ).
@@ -126,8 +126,8 @@
127127 'type' => 'submit',
128128 'value' => wfMsg( 'nss-create-account' )
129129 ) ).
130 - "</div>\n</form>"
131 - );
 130+ "</div>\n</form>"
 131+ );
132132 }
133133
134134 function processData() {
@@ -145,13 +145,13 @@
146146
147147 $username = strtolower( $parts[1] );
148148 $keyname = strtolower( $parts[2] );
149 -
 149+
150150 if( !isset( $this->users[$username] ) )
151151 continue;
152152
153153 if( !in_array( $keyname, $wgUserProperties ) )
154154 continue;
155 -
 155+
156156 $this->users[$username]->set( $keyname, $value );
157157 }
158158
@@ -159,14 +159,14 @@
160160 $user->update();
161161 return true;
162162 }
163 -
 163+
164164 function processCreateAccount() {
165165 global $wgRequest, $wgUserProperties;
166166 if( !$wgRequest->wasPosted() || $wgRequest->getVal('action') != 'create' )
167167 return;
168168
169169 $options = array();
170 -
 170+
171171 $post = $wgRequest->getValues();
172172 foreach( $post as $key => $value ) {
173173 if( substr( $key, 0, 3 ) != 'am-' )
@@ -179,22 +179,22 @@
180180 $options[$keyname] = $value;
181181 }
182182 if( empty( $options['username'] ) ) {
183 - $this->mErrors[] = 'noname';
 183+ $this->mErrors[] = 'noname';
184184 return false;
185185 }
186186 $username = $options['username'];
187187 unset( $options['username'] );
188 -
 188+
189189 global $wgAuth;
190190 $password = $wgAuth->createAccount($username, $options);
191 -
 191+
192192 $userprops = UserProps::loadFromDb( $username );
193193 if ( !$userprops ) {
194194 $this->mErrors[] = 'nss-db-error';
195195 return false;
196196 }
197197 $this->users[$userprops->getName()] = $userprops;
198 -
 198+
199199 global $wgPasswordSender;
200200 $email = wfMsg( 'nss-welcome-mail', $username, $password );
201201 $mailSubject = wfMsg( 'nss-welcome-mail-subject' );
@@ -210,13 +210,13 @@
211211
212212 return true;
213213 }
214 -
 214+
215215 function showErrors() {
216216 if ( !$this->mErrors )
217217 return;
218218 global $wgOut;
219219 foreach( $this->mErrors as $error )
220 - $wgOut->addHTML(
 220+ $wgOut->addHTML(
221221 Xml::element( 'p',
222222 array( 'class' => 'error' ),
223223 wfMsg( $error )
@@ -240,11 +240,11 @@
241241 static function loadFromDb( $username ) {
242242 $res = self::select( $username );
243243 $row = $res->fetchObject();
244 - if ( !$row )
 244+ if ( !$row )
245245 return false;
246246 return new self( $row->pwd_name, $row->pwd_email, $row->pwd_active );
247247 }
248 -
 248+
249249 function __construct( $username, $email = null, $active = null ) {
250250 $this->username = $username;
251251 $this->props = array();
@@ -267,7 +267,7 @@
268268 return $this->active;
269269 }
270270 function setActive( $active ) {
271 - $this->active = $active;
 271+ $this->active = $active;
272272 }
273273
274274 static function select($username = null) {
@@ -278,7 +278,7 @@
279279 return $dbr->select(
280280 array( 'user_props', 'passwd' ),
281281 array( 'up_name', 'up_value', 'pwd_name', 'pwd_email', 'pwd_active' ),
282 - $where,
 282+ $where,
283283 __METHOD__,
284284 array( 'ORDER BY' => 'pwd_name ASC, up_timestamp ASC' ),
285285 array( 'passwd' => array( 'RIGHT JOIN', 'pwd_name = up_user' ) )
@@ -301,7 +301,7 @@
302302 $diff = array_diff_assoc($this->props, $this->old_props);
303303 if( !count( $diff ) ) return;
304304
305 -
 305+
306306 global $wgAuth;
307307 $dbw = $wgAuth->getDB( DB_WRITE );
308308 $timestamp = $dbw->timestamp();
@@ -309,8 +309,8 @@
310310 if( isset( $diff['email'] ) || isset( $diff['active'] ) ) {
311311 if ( isset( $diff['email'] ) ) $this->email = $diff['email'];
312312 if ( isset( $diff['active'] ) ) $this->active = $diff['active'];
313 - $dbw->update( 'passwd',
314 - array( 'pwd_email' => $this->email, 'pwd_active' => $this->active ),
 313+ $dbw->update( 'passwd',
 314+ array( 'pwd_email' => $this->email, 'pwd_active' => $this->active ),
315315 array( 'pwd_user' => $this->username ),
316316 __METHOD__
317317 );

Status & tagging log