Index: trunk/extensions/NewUserMessage/NewUserMessage.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | |
16 | 16 | define('NEWUSERMESSAGE_VERSION','2.0, 2008-06-04'); |
17 | 17 | |
18 | | -$wgNewUserSupressRC = false; // Specify whether or not the new user message creation should show up in recent changes |
| 18 | +$wgNewUserSuppressRC = false; // Specify whether or not the new user message creation should show up in recent changes |
19 | 19 | $wgNewUserMinorEdit = true; // Should the new user message creation be a minor edit? |
20 | 20 | $wgNewUserMessageOnAutoCreate = false; // Should auto creation (CentralAuth) trigger a new user message? |
21 | 21 | |
Index: trunk/extensions/NewUserMessage/NewUserMessage.class.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | $talk = $user->getTalkPage(); |
23 | 23 | |
24 | 24 | if (!$talk->exists()) { |
25 | | - global $wgUser, $wgNewUserMinorEdit, $wgNewUserSupressRC; |
| 25 | + global $wgUser, $wgNewUserMinorEdit, $wgNewUserSuppressRC; |
26 | 26 | |
27 | 27 | wfLoadExtensionMessages( 'NewUserMessage' ); |
28 | 28 | |
— | — | @@ -48,25 +48,25 @@ |
49 | 49 | $templateTitleText = $templateTitle->getText(); |
50 | 50 | } |
51 | 51 | if ($wgNewUserMinorEdit) $flags = $flags | EDIT_MINOR; |
52 | | - if ($wgNewUserSupressRC) $flags = $flags | EDIT_SUPPRESS_RC; |
| 52 | + if ($wgNewUserSuppressRC) $flags = $flags | EDIT_SUPPRESS_RC; |
53 | 53 | |
54 | 54 | $dbw = wfGetDB( DB_MASTER ); |
55 | 55 | $dbw->begin(); |
56 | 56 | $good = true; |
57 | | - |
58 | | - $signatures = wfMsgForContent('newusermessage-signatures'); |
59 | | - if (!wfEmptyMsg('newusermessage-signatures', $signatures)) { |
| 57 | + |
| 58 | + $text = "{{{$templateTitleText}|$name}}"; |
| 59 | + $signatures = wfMsgForContent( 'newusermessage-signatures' ); |
| 60 | + if ( !wfEmptyMsg( 'newusermessage-signatures', $signatures ) ) { |
60 | 61 | $pattern = '/^\* ?(.*?)$/m'; |
61 | | - preg_match_all($pattern, $signatures, $signaturesList, PREG_SET_ORDER); |
62 | | - $rand = rand(0, count($signaturesList)-1); |
63 | | - $signature = $signaturesList[$rand][1]; |
| 62 | + preg_match_all( $pattern, $signatures, $signatureList, PREG_SET_ORDER ); |
| 63 | + if ( count( $signatureList ) > 0 ) { |
| 64 | + $rand = rand( 0, count( $signatureList ) - 1 ); |
| 65 | + $signature = $signatureList[$rand][1]; |
| 66 | + $text .= "\n-- {$signature} ~~~~~"; |
| 67 | + } |
64 | 68 | } |
65 | 69 | try { |
66 | | - if (!wfEmptyMsg('newusermessage-signatures', $signatures)) { |
67 | | - $article->doEdit("{{{$templateTitleText}|$name}}\n--" . $signature . "~~~~~" , wfMsgForContent( 'newuseredit-summary' ), $flags); |
68 | | - } else { |
69 | | - $article->doEdit("{{{$templateTitleText}|$name}}", wfMsgForContent( 'newuseredit-summary' ), $flags); |
70 | | - } |
| 70 | + $article->doEdit( $text, wfMsgForContent( 'newuseredit-summary' ), $flags ); |
71 | 71 | } catch ( DBQueryError $e ) { |
72 | 72 | $good = false; |
73 | 73 | } |