Index: trunk/phase3/includes/api/ApiBlock.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | * of success. If it fails, the result will specify the nature of the error. |
51 | 51 | */ |
52 | 52 | public function execute() { |
53 | | - global $wgUser; |
| 53 | + global $wgUser, $wgBlockAllowsUTEdit; |
54 | 54 | $this->getMain()->requestWriteMode(); |
55 | 55 | $params = $this->extractRequestParams(); |
56 | 56 | |
— | — | @@ -84,6 +84,7 @@ |
85 | 85 | $form->BlockEnableAutoblock = $params['autoblock']; |
86 | 86 | $form->BlockEmail = $params['noemail']; |
87 | 87 | $form->BlockHideName = $params['hidename']; |
| 88 | + $form->BlockAllowUsertalk = $params['allowusertalk'] && $wgBlockAllowsUTEdit; |
88 | 89 | |
89 | 90 | $userID = $expiry = null; |
90 | 91 | $retval = $form->doBlock($userID, $expiry); |
— | — | @@ -105,6 +106,8 @@ |
106 | 107 | $res['noemail'] = ''; |
107 | 108 | if($params['hidename']) |
108 | 109 | $res['hidename'] = ''; |
| 110 | + if($params['allowusertalk']) |
| 111 | + $res['allowusertalk'] = ''; |
109 | 112 | |
110 | 113 | $this->getResult()->addValue(null, $this->getModuleName(), $res); |
111 | 114 | } |
— | — | @@ -112,6 +115,7 @@ |
113 | 116 | public function mustBePosted() { return true; } |
114 | 117 | |
115 | 118 | public function getAllowedParams() { |
| 119 | + global $wgBlockAllowsUTEdit; |
116 | 120 | return array ( |
117 | 121 | 'user' => null, |
118 | 122 | 'token' => null, |
— | — | @@ -123,6 +127,7 @@ |
124 | 128 | 'autoblock' => false, |
125 | 129 | 'noemail' => false, |
126 | 130 | 'hidename' => false, |
| 131 | + 'allowusertalk' => $wgBlockAllowsUTEdit, |
127 | 132 | ); |
128 | 133 | } |
129 | 134 | |
— | — | @@ -137,7 +142,8 @@ |
138 | 143 | 'nocreate' => 'Prevent account creation', |
139 | 144 | 'autoblock' => 'Automatically block the last used IP address, and any subsequent IP addresses they try to login from', |
140 | 145 | 'noemail' => 'Prevent user from sending e-mail through the wiki. (Requires the "blockemail" right.)', |
141 | | - 'hidename' => 'Hide the username from the block log. (Requires the "hideuser" right.)' |
| 146 | + 'hidename' => 'Hide the username from the block log. (Requires the "hideuser" right.)', |
| 147 | + 'allowusertalk' => 'Whether to allow the user to edit their own talk page (Dependent on $wgBlockAllowsUTEdit)' |
142 | 148 | ); |
143 | 149 | } |
144 | 150 | |
Index: trunk/phase3/includes/specials/SpecialBlockip.php |
— | — | @@ -287,7 +287,7 @@ |
288 | 288 | * @return array(message key, arguments) on failure, empty array on success |
289 | 289 | */ |
290 | 290 | function doBlock( &$userId = null, &$expiry = null ) { |
291 | | - global $wgUser, $wgSysopUserBans, $wgSysopRangeBans; |
| 291 | + global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit; |
292 | 292 | |
293 | 293 | $userId = 0; |
294 | 294 | # Expand valid IPv6 addresses, usernames are left as is |
— | — | @@ -374,7 +374,7 @@ |
375 | 375 | $block = new Block( $this->BlockAddress, $userId, $wgUser->getId(), |
376 | 376 | $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly, |
377 | 377 | $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName, |
378 | | - $this->BlockEmail, $this->BlockAllowUsertalk ); |
| 378 | + $this->BlockEmail, isset( $this->BlockAllowUsertalk ) ? $this->BlockAllowUsertalk : $wgBlockAllowsUTEdit ); |
379 | 379 | |
380 | 380 | if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) { |
381 | 381 | |