Index: trunk/phase3/includes/Article.php |
— | — | @@ -926,13 +926,11 @@ |
927 | 927 | return; |
928 | 928 | } |
929 | 929 | |
930 | | - if ((!$wgUser->isAllowed('delete'))) { |
931 | | - $wgOut->permissionRequired( 'delete' ); |
932 | | - return; |
933 | | - } |
| 930 | + $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgUser ); |
934 | 931 | |
935 | | - if (wfReadOnly()) { |
936 | | - $wgOut->readOnlyPage(); |
| 932 | + if (count($permission_errors)>0) |
| 933 | + { |
| 934 | + $wgOut->showPermissionsErrorPage( $permission_errors ); |
937 | 935 | return; |
938 | 936 | } |
939 | 937 | |
— | — | @@ -1835,18 +1833,11 @@ |
1836 | 1834 | # This code desperately needs to be totally rewritten |
1837 | 1835 | |
1838 | 1836 | # Check permissions |
1839 | | - if( $wgUser->isAllowed( 'delete' ) ) { |
1840 | | - if( $wgUser->isBlocked( !$confirm ) ) { |
1841 | | - $wgOut->blockedPage(); |
1842 | | - return; |
1843 | | - } |
1844 | | - } else { |
1845 | | - $wgOut->permissionRequired( 'delete' ); |
1846 | | - return; |
1847 | | - } |
| 1837 | + $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgUser ); |
1848 | 1838 | |
1849 | | - if( wfReadOnly() ) { |
1850 | | - $wgOut->readOnlyPage(); |
| 1839 | + if (count($permission_errors)>0) |
| 1840 | + { |
| 1841 | + $wgOut->showPermissionsErrorPage( $permission_errors ); |
1851 | 1842 | return; |
1852 | 1843 | } |
1853 | 1844 | |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1030,12 +1030,16 @@ |
1031 | 1031 | * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries. |
1032 | 1032 | * @return array Array of arrays of the arguments to wfMsg to explain permissions problems. |
1033 | 1033 | */ |
1034 | | - public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true ) { |
| 1034 | + public function getUserPermissionsErrors( $action, $user = null, $doExpensiveQueries = true ) { |
1035 | 1035 | $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries ); |
1036 | 1036 | |
1037 | 1037 | global $wgContLang; |
1038 | 1038 | global $wgLang; |
1039 | 1039 | |
| 1040 | + # Be kinder to people who forget to supply a user, assuming they mean $wgUser |
| 1041 | + if (!$user) |
| 1042 | + $user = $wgUser; |
| 1043 | + |
1040 | 1044 | if ( wfReadOnly() && $action != 'read' ) { |
1041 | 1045 | global $wgReadOnly; |
1042 | 1046 | $errors[] = array( 'readonlytext', $wgReadOnly ); |
— | — | @@ -1043,7 +1047,7 @@ |
1044 | 1048 | |
1045 | 1049 | global $wgEmailConfirmToEdit, $wgUser; |
1046 | 1050 | |
1047 | | - if ( $wgEmailConfirmToEdit && !$wgUser->isEmailConfirmed() ) |
| 1051 | + if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) |
1048 | 1052 | { |
1049 | 1053 | $errors[] = array( 'confirmedittext' ); |
1050 | 1054 | } |