r23528 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23527‎ | r23528 | r23529 >
Date:22:34, 28 June 2007
Author:robchurch
Status:old
Tags:
Comment:
* Fix read permission check for special pages with subpage parameters, e.g. Special:Confirmemail
* Fix read permission check for page titles consisting of one or more zeros, e.g. "0", "00" etc.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1148,7 +1148,7 @@
11491149 return $result;
11501150 }
11511151
1152 - if( $wgUser->isAllowed('read') ) {
 1152+ if( $wgUser->isAllowed( 'read' ) ) {
11531153 return true;
11541154 } else {
11551155 global $wgWhitelistRead;
@@ -1160,19 +1160,35 @@
11611161 if( $this->isSpecial( 'Userlogin' ) || $this->isSpecial( 'Resetpass' ) ) {
11621162 return true;
11631163 }
1164 -
1165 - /** some pages are explicitly allowed */
 1164+
 1165+ /**
 1166+ * Check for explicit whitelisting
 1167+ */
11661168 $name = $this->getPrefixedText();
1167 - if( $wgWhitelistRead && in_array( $name, $wgWhitelistRead ) ) {
 1169+ if( $wgWhitelistRead && in_array( $name, $wgWhitelistRead, true ) )
11681170 return true;
1169 - }
1170 -
1171 - # Compatibility with old settings
 1171+
 1172+ /**
 1173+ * Old settings might have the title prefixed with
 1174+ * a colon for main-namespace pages
 1175+ */
11721176 if( $wgWhitelistRead && $this->getNamespace() == NS_MAIN ) {
1173 - if( in_array( ':' . $name, $wgWhitelistRead ) ) {
 1177+ if( in_array( ':' . $name, $wgWhitelistRead ) )
11741178 return true;
1175 - }
11761179 }
 1180+
 1181+ /**
 1182+ * If it's a special page, ditch the subpage bit
 1183+ * and check again
 1184+ */
 1185+ if( $this->getNamespace() == NS_SPECIAL ) {
 1186+ $name = $this->getText();
 1187+ list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $name );
 1188+ $pure = SpecialPage::getTitleFor( $name )->getPrefixedText();
 1189+ if( in_array( $pure, $wgWhitelistRead, true ) )
 1190+ return true;
 1191+ }
 1192+
11771193 }
11781194 return false;
11791195 }
Index: trunk/phase3/RELEASE-NOTES
@@ -234,6 +234,10 @@
235235 * (bug 10401) Provide non-redirecting link to original title in Special:Movepage
236236 * Fix broken handling of log views for page titles consisting of one
237237 or more zeros, e.g. "0", "00" etc.
 238+* Fix read permission check for special pages with subpage parameters, e.g.
 239+ Special:Confirmemail
 240+* Fix read permission check for page titles consisting of one or more zeros,
 241+ e.g. "0", "00" etc.
238242
239243 == API changes since 1.10 ==
240244

Follow-up revisions

RevisionCommit summaryAuthorDate
r23581Merged revisions 23406-23580 via svnmerge from...david04:50, 30 June 2007

Status & tagging log