Index: trunk/phase3/includes/Title.php |
— | — | @@ -1117,9 +1117,7 @@ |
1118 | 1118 | else if( $result === false ) |
1119 | 1119 | $errors[] = array('badaccess-group0'); # a generic "We don't want them to do that" |
1120 | 1120 | } |
1121 | | - if( $doExpensiveQueries && !wfRunHooks( 'getUserPermissionsErrorsExpensive', |
1122 | | - array(&$this,&$user,$action,&$result) ) ) |
1123 | | - { |
| 1121 | + if( $doExpensiveQueries && !wfRunHooks( 'getUserPermissionsErrorsExpensive', array(&$this,&$user,$action,&$result) ) ) { |
1124 | 1122 | if( is_array($result) && count($result) && !is_array($result[0]) ) |
1125 | 1123 | $errors[] = $result; # A single array representing an error |
1126 | 1124 | else if( is_array($result) && is_array($result[0]) ) |
— | — | @@ -1145,8 +1143,7 @@ |
1146 | 1144 | |
1147 | 1145 | # protect css/js subpages of user pages |
1148 | 1146 | # XXX: this might be better using restrictions |
1149 | | - # XXX: Find a way to work around the php bug that prevents using |
1150 | | - # $this->userCanEditCssJsSubpage() from working |
| 1147 | + # XXX: Find a way to work around the php bug that prevents using $this->userCanEditCssJsSubpage() from working |
1151 | 1148 | if( $this->isCssJsSubpage() && !$user->isAllowed('editusercssjs') |
1152 | 1149 | && !preg_match('/^'.preg_quote($user->getName(), '/').'\//', $this->mTextform) ) |
1153 | 1150 | { |
— | — | @@ -1168,41 +1165,39 @@ |
1169 | 1166 | $right = ( $right == 'sysop' ) ? 'protect' : $right; |
1170 | 1167 | if( '' != $right && !$user->isAllowed( $right ) ) { |
1171 | 1168 | $pages = ''; |
1172 | | - foreach( $cascadingSources as $page ) { |
| 1169 | + foreach( $cascadingSources as $page ) |
1173 | 1170 | $pages .= '* [[:' . $page->getPrefixedText() . "]]\n"; |
1174 | | - } |
1175 | 1171 | $errors[] = array( 'cascadeprotected', count( $cascadingSources ), $pages ); |
1176 | 1172 | } |
1177 | 1173 | } |
1178 | 1174 | } |
1179 | 1175 | } |
1180 | 1176 | |
1181 | | - # Get restrictions on each action, 'create' handled below |
1182 | | - if( $action != 'create' ) { |
1183 | | - foreach( $this->getRestrictions($action) as $right ) { |
1184 | | - // Backwards compatibility, rewrite sysop -> protect |
1185 | | - if( $right == 'sysop' ) { |
1186 | | - $right = 'protect'; |
1187 | | - } |
1188 | | - if( '' != $right && !$user->isAllowed( $right ) ) { |
1189 | | - // Users with 'editprotected' permission can edit protected pages |
1190 | | - if( $action=='edit' && $user->isAllowed( 'editprotected' ) ) { |
1191 | | - // Users with 'editprotected' permission cannot edit protected pages |
1192 | | - // with cascading option turned on. |
1193 | | - if( $this->mCascadeRestriction ) { |
1194 | | - $errors[] = array( 'protectedpagetext', $right ); |
1195 | | - } else { |
1196 | | - // Nothing, user can edit! |
1197 | | - } |
1198 | | - } else { |
| 1177 | + foreach( $this->getRestrictions($action) as $right ) { |
| 1178 | + // Backwards compatibility, rewrite sysop -> protect |
| 1179 | + if( $right == 'sysop' ) { |
| 1180 | + $right = 'protect'; |
| 1181 | + } |
| 1182 | + if( '' != $right && !$user->isAllowed( $right ) ) { |
| 1183 | + // Users with 'editprotected' permission can edit protected pages |
| 1184 | + if( $action=='edit' && $user->isAllowed( 'editprotected' ) ) { |
| 1185 | + // Users with 'editprotected' permission cannot edit protected pages |
| 1186 | + // with cascading option turned on. |
| 1187 | + if( $this->mCascadeRestriction ) { |
1199 | 1188 | $errors[] = array( 'protectedpagetext', $right ); |
| 1189 | + } else { |
| 1190 | + // Nothing, user can edit! |
1200 | 1191 | } |
| 1192 | + } else { |
| 1193 | + $errors[] = array( 'protectedpagetext', $right ); |
1201 | 1194 | } |
1202 | 1195 | } |
1203 | 1196 | } |
1204 | 1197 | |
1205 | | - if( $action == 'protect' && $this->getUserPermissionsErrors('edit',$user) != array() ) { |
1206 | | - $errors[] = array( 'protect-cantedit' ); // If they can't edit, they shouldn't protect. |
| 1198 | + if( $action == 'protect' ) { |
| 1199 | + if( $this->getUserPermissionsErrors('edit', $user) != array() ) { |
| 1200 | + $errors[] = array( 'protect-cantedit' ); // If they can't edit, they shouldn't protect. |
| 1201 | + } |
1207 | 1202 | } |
1208 | 1203 | |
1209 | 1204 | if( $action == 'create' ) { |