Index: trunk/phase3/includes/Title.php |
— | — | @@ -1282,11 +1282,14 @@ |
1283 | 1283 | # XXX: this might be better using restrictions |
1284 | 1284 | # XXX: Find a way to work around the php bug that prevents using $this->userCanEditCssSubpage() |
1285 | 1285 | # and $this->userCanEditJsSubpage() from working |
1286 | | - if( $this->isCssSubpage() && !$user->isAllowed('editusercss' ) && $action != 'patrol' |
| 1286 | + # XXX: right 'editusercssjs' is deprecated, for backward compatibility only |
| 1287 | + if( $this->isCssSubpage() && ( !$user->isAllowed('editusercssjs') || !$user->isAllowed('editusercss') ) |
| 1288 | + && $action != 'patrol' |
1287 | 1289 | && !preg_match('/^'.preg_quote($user->getName(), '/').'\//', $this->mTextform) ) |
1288 | 1290 | { |
1289 | 1291 | $errors[] = array('customcssjsprotected'); |
1290 | | - } else if( $this->isJsSubpage() && !$user->isAllowed('edituserjs' ) && $action != 'patrol' |
| 1292 | + } else if( $this->isJsSubpage() && ( !$user->isAllowed('editusercssjs') || !$user->isAllowed('edituserjs') ) |
| 1293 | + && $action != 'patrol' |
1291 | 1294 | && !preg_match('/^'.preg_quote($user->getName(), '/').'\//', $this->mTextform) ) |
1292 | 1295 | { |
1293 | 1296 | $errors[] = array('customcssjsprotected'); |
— | — | @@ -1725,7 +1728,8 @@ |
1726 | 1729 | */ |
1727 | 1730 | public function userCanEditCssSubpage() { |
1728 | 1731 | global $wgUser; |
1729 | | - return ( $wgUser->isAllowed('editusercss') || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) ); |
| 1732 | + return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('editusercss') ) |
| 1733 | + || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) ); |
1730 | 1734 | } |
1731 | 1735 | /** |
1732 | 1736 | * Protect js subpages of user pages: can $wgUser edit |
— | — | @@ -1736,7 +1740,8 @@ |
1737 | 1741 | */ |
1738 | 1742 | public function userCanEditJsSubpage() { |
1739 | 1743 | global $wgUser; |
1740 | | - return ( $wgUser->isAllowed('edituserjs') || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) ); |
| 1744 | + return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('edituserjs') ) |
| 1745 | + || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) ); |
1741 | 1746 | } |
1742 | 1747 | |
1743 | 1748 | /** |