From 64ce6148e6b3a300cedca71a71e581cac28c46c8 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 12 Dec 2006 23:13:14 +0000 Subject: [PATCH] * (bug 8241) Don't consider user pages of User:Foo.css/User:Foo.js to be CSS/JS subpages. Patch by Fyren. --- RELEASE-NOTES | 1 + includes/Title.php | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 72ffd6296b..9f87ef678d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -293,6 +293,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN is illegal or cannot be set via $wgAuth. These can be caught and a human- readable error message displayed by UI code. * Added Title::isSubpage() +* (bug 8241) Don't consider user pages of User:Foo.css to be CSS subpages == Languages updated == diff --git a/includes/Title.php b/includes/Title.php index dce53d1e73..8912dbc6ea 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1089,8 +1089,7 @@ class Title { # protect css/js subpages of user pages # XXX: this might be better using restrictions # XXX: Find a way to work around the php bug that prevents using $this->userCanEditCssJsSubpage() from working - if( NS_USER == $this->mNamespace - && preg_match("/\\.(css|js)$/", $this->mTextform ) + if( $this->isCssJsSubpage() && !$wgUser->isAllowed('editinterface') && !preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) ) { wfProfileOut( $fname ); @@ -1233,7 +1232,7 @@ class Title { * @access public */ function isCssJsSubpage() { - return ( NS_USER == $this->mNamespace and preg_match("/\\.(css|js)$/", $this->mTextform ) ); + return ( NS_USER == $this->mNamespace and preg_match("/\\/.*\\.(css|js)$/", $this->mTextform ) ); } /** * Is this a *valid* .css or .js subpage of a user page? @@ -1261,7 +1260,7 @@ class Title { * @access public */ function isCssSubpage() { - return ( NS_USER == $this->mNamespace and preg_match("/\\.css$/", $this->mTextform ) ); + return ( NS_USER == $this->mNamespace and preg_match("/\\/.*\\.css$/", $this->mTextform ) ); } /** * Is this a .js subpage of a user page? @@ -1269,7 +1268,7 @@ class Title { * @access public */ function isJsSubpage() { - return ( NS_USER == $this->mNamespace and preg_match("/\\.js$/", $this->mTextform ) ); + return ( NS_USER == $this->mNamespace and preg_match("/\\/.*\\.js$/", $this->mTextform ) ); } /** * Protect css/js subpages of user pages: can $wgUser edit -- 2.20.1