quick hack to protect css/js subpages of userpages. Should be replaced by some more...
authorGabriel Wicke <gwicke@users.mediawiki.org>
Wed, 28 Apr 2004 19:30:21 +0000 (19:30 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Wed, 28 Apr 2004 19:30:21 +0000 (19:30 +0000)
includes/Title.php

index 77b1a95..cd91d19 100644 (file)
@@ -487,6 +487,13 @@ class Title {
                if ( -1 == $this->mNamespace ) { return false; }
                # if ( 0 == $this->getArticleID() ) { return false; }
                if ( $this->mDbkeyform == "_" ) { return false; }
+               # protect css/js subpages of user pages
+               # XXX: this might be better using restrictions
+               if( Namespace::getUser() == $this->mNamespace
+                       and preg_match("/\\.(css|js)$/", $this->mTextform )
+                       and !$wgUser->isDeveloper()
+                       and !preg_match("/^".$wgUser->getName()."/", $this->mTextform) )
+               { return false; }
 
                $ur = $wgUser->getRights();
                foreach ( $this->getRestrictions() as $r ) {