Index: trunk/extensions/Babel/Babel.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | $wgExtensionCredits['parserhook'][] = array( |
23 | 23 | 'path' => __FILE__, |
24 | 24 | 'name' => 'Babel', |
25 | | - 'version' => '1.7.0', |
| 25 | + 'version' => '1.7.1', |
26 | 26 | 'author' => 'Robert Leverington', |
27 | 27 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Babel', |
28 | 28 | 'descriptionmsg' => 'babel-desc', |
Index: trunk/extensions/Babel/BabelAutoCreate.class.php |
— | — | @@ -38,12 +38,19 @@ |
39 | 39 | $text = wfMsgForContent( 'babel-autocreate-text-levels', $level, $language ); |
40 | 40 | } |
41 | 41 | $article = new Article( $title ); |
| 42 | + |
| 43 | + $user = self::user(); |
| 44 | + # Do not add a message if the username is invalid or if the account that adds it, is blocked |
| 45 | + if( !$user || $user->isBlocked() ) { |
| 46 | + return; |
| 47 | + } |
| 48 | + |
42 | 49 | $article->doEdit( |
43 | 50 | $text, |
44 | 51 | wfMsgForContent( 'babel-autocreate-reason', wfMsgForContent( 'babel-url' ) ), |
45 | 52 | EDIT_FORCE_BOT, |
46 | 53 | false, |
47 | | - self::user() |
| 54 | + $user |
48 | 55 | ); |
49 | 56 | } |
50 | 57 | |
— | — | @@ -54,8 +61,8 @@ |
55 | 62 | */ |
56 | 63 | public static function user() { |
57 | 64 | if ( !self::$user ) { |
58 | | - self::$user = User::newFromName( wfMsgForContent( 'babel-autocreate-user' ), false ); |
59 | | - if ( !self::$user->isLoggedIn() ) { |
| 65 | + self::$user = User::newFromName( wfMsgForContent( 'babel-autocreate-user' ) ); |
| 66 | + if ( self::$user && !self::$user->isLoggedIn() ) { |
60 | 67 | self::$user->addToDatabase(); |
61 | 68 | } |
62 | 69 | } |
Index: trunk/extensions/NewUserMessage/NewUserMessage.class.php |
— | — | @@ -23,6 +23,11 @@ |
24 | 24 | // Create a user object for the editing user and add it to the |
25 | 25 | // database if it is not there already |
26 | 26 | $editor = User::newFromName( wfMsgForContent( 'newusermessage-editor' ) ); |
| 27 | + |
| 28 | + if( !$editor ) { |
| 29 | + return false; # Invalid user name |
| 30 | + } |
| 31 | + |
27 | 32 | if ( !$editor->isLoggedIn() ) { |
28 | 33 | $editor->addToDatabase(); |
29 | 34 | } |
— | — | @@ -157,8 +162,8 @@ |
158 | 163 | $editor = self::fetchEditor(); |
159 | 164 | $flags = self::fetchFlags(); |
160 | 165 | |
161 | | - # Do not add a message if the account that adds it, is blocked |
162 | | - if( $editor->isBlocked() ) { |
| 166 | + # Do not add a message if the username is invalid or if the account that adds it, is blocked |
| 167 | + if( !$editor || $editor->isBlocked() ) { |
163 | 168 | return true; |
164 | 169 | } |
165 | 170 | |