Index: trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | 'descriptionmsg' => 'confirmedit-desc', |
14 | 14 | 'author' => 'Aaron Schulz', |
15 | 15 | 'url' => 'http://www.mediawiki.org/wiki/Extension:ConfirmAccount', |
16 | | - 'version' => '1.45', |
| 16 | + 'version' => '1.46', |
17 | 17 | ); |
18 | 18 | |
19 | 19 | # This extension needs email enabled! |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php |
— | — | @@ -1142,7 +1142,9 @@ |
1143 | 1143 | } |
1144 | 1144 | $transaction = new FSTransaction(); |
1145 | 1145 | if( !FileStore::lock() ) { |
| 1146 | + $dbw->delete( 'user', array( 'user_id' => $user->getID() ) ); |
1146 | 1147 | wfDebug( __METHOD__.": failed to acquire file store lock, aborting\n" ); |
| 1148 | + return false; |
1147 | 1149 | } |
1148 | 1150 | $path = $storeOld->filePath( $key ); |
1149 | 1151 | if( $path && file_exists($path) ) { |
— | — | @@ -1190,8 +1192,8 @@ |
1191 | 1193 | $transaction->commit(); |
1192 | 1194 | } |
1193 | 1195 | |
| 1196 | + # Grant any necessary rights |
1194 | 1197 | $grouptext = $group = ''; |
1195 | | - # Grant any necessary rights |
1196 | 1198 | global $wgAccountRequestTypes; |
1197 | 1199 | if( array_key_exists($this->mType,$wgAccountRequestTypes) ) { |
1198 | 1200 | $params = $wgAccountRequestTypes[$this->mType]; |
— | — | @@ -1203,8 +1205,8 @@ |
1204 | 1206 | } |
1205 | 1207 | } |
1206 | 1208 | |
| 1209 | + # Send out password |
1207 | 1210 | $ebody = ''; |
1208 | | - # Send out password |
1209 | 1211 | if( $this->reason ) { |
1210 | 1212 | # If the user is in a group and there is a welcome for that group, use it |
1211 | 1213 | if( $group && !wfEmptyMsg( "confirmaccount-email-body2-pos{$this->mType}", wfMsg("confirmaccount-email-body2-pos{$this->mType}") ) ) { |
— | — | @@ -1225,10 +1227,10 @@ |
1226 | 1228 | } |
1227 | 1229 | } |
1228 | 1230 | $result = $user->sendMail( wfMsg( 'confirmaccount-email-subj' ), $ebody ); |
1229 | | - |
1230 | 1231 | if( WikiError::isError( $result ) ) { |
1231 | 1232 | $errors[] = wfMsg( 'mailerror', htmlspecialchars( $result->toString() ) ); |
1232 | 1233 | } |
| 1234 | + |
1233 | 1235 | # Safe to hook/log now... |
1234 | 1236 | wfRunHooks( 'AddNewAccount', array( $user ) ); |
1235 | 1237 | # OK, now remove the request from the queue |
— | — | @@ -1257,10 +1259,8 @@ |
1258 | 1260 | } |
1259 | 1261 | # Start up the user's (presumedly brand new) userpages |
1260 | 1262 | # Will not append, so previous content will be blanked |
1261 | | - global $wgMakeUserPageFromBio; |
| 1263 | + global $wgMakeUserPageFromBio, $wgAutoUserBioText; |
1262 | 1264 | if( $wgMakeUserPageFromBio ) { |
1263 | | - global $wgAutoUserBioText; |
1264 | | - |
1265 | 1265 | $usertitle = $user->getUserPage(); |
1266 | 1266 | $userpage = new Article( $usertitle ); |
1267 | 1267 | |
— | — | @@ -1273,7 +1273,6 @@ |
1274 | 1274 | foreach( $areas as $n => $line ) { |
1275 | 1275 | $set = explode("|",$line); |
1276 | 1276 | $name = str_replace("_"," ",$set[0]); |
1277 | | - |
1278 | 1277 | if( in_array($set[0],$this->mAreaSet) ) { |
1279 | 1278 | # General userpage text for anyone with this interest |
1280 | 1279 | if( isset($set[2]) ) { |
— | — | @@ -1287,12 +1286,16 @@ |
1288 | 1287 | } |
1289 | 1288 | } |
1290 | 1289 | } |
1291 | | - # Set sortkey |
1292 | | - global $wgConfirmAccountSortkey; |
| 1290 | + # Set sortkey and use it on bio |
| 1291 | + global $wgConfirmAccountSortkey, $wgContLang; |
1293 | 1292 | if( !empty($wgConfirmAccountSortkey) ) { |
1294 | | - $sortKey = $usertitle->getText(); |
1295 | | - $sortKey = preg_replace( $wgConfirmAccountSortkey[0], $wgConfirmAccountSortkey[1], $sortKey ); |
| 1293 | + $sortKey = preg_replace($wgConfirmAccountSortkey[0],$wgConfirmAccountSortkey[1],$usertitle->getText()); |
1296 | 1294 | $body .= "\n{{DEFAULTSORT:{$sortKey}}}"; |
| 1295 | + # Clean up any other categories... |
| 1296 | + $catNS = $wgContLang->getNSText(NS_CATEGORY); |
| 1297 | + $replace = '/\[\['.preg_quote($catNS).':([^\]]+)\]\]/i'; // [[Category:x]] |
| 1298 | + $with = "[[{$catNS}:$1|".str_replace('$','\$',$sortKey)."]]"; // [[Category:x|sortkey]] |
| 1299 | + $body = preg_replace( $replace, $with, $body ); |
1297 | 1300 | } |
1298 | 1301 | # Create userpage! |
1299 | 1302 | $userpage->doEdit( $body, wfMsg('confirmaccount-summary'), EDIT_MINOR ); |
— | — | @@ -1310,7 +1313,7 @@ |
1311 | 1314 | # Add user welcome message! |
1312 | 1315 | $utalk->doEdit( $welcome . ' ~~~~', wfMsg('confirmaccount-wsum'), EDIT_MINOR ); |
1313 | 1316 | } |
1314 | | - |
| 1317 | + # Finally, done!!! |
1315 | 1318 | $this->showSuccess( $this->submitType, $user->getName(), $errors ); |
1316 | 1319 | } else if( $this->submitType == 'hold' ) { |
1317 | 1320 | global $wgUser; |