Allow explicit & implicit null returns from hook handlers
[lhc/web/wiklou.git] / includes / Title.php
index 6f43e44..9d42b2f 100644 (file)
@@ -1891,12 +1891,19 @@ class Title {
                # Protect css/js subpages of user pages
                # XXX: this might be better using restrictions
                # XXX: right 'editusercssjs' is deprecated, for backward compatibility only
-               if ( $action != 'patrol' && !$user->isAllowed( 'editusercssjs' )
-                               && !preg_match( '/^' . preg_quote( $user->getName(), '/' ) . '\//', $this->mTextform ) ) {
-                       if ( $this->isCssSubpage() && !$user->isAllowed( 'editusercss' ) ) {
-                               $errors[] = array( 'customcssprotected' );
-                       } elseif ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) {
-                               $errors[] = array( 'customjsprotected' );
+               if ( $action != 'patrol' && !$user->isAllowed( 'editusercssjs' ) ) {
+                       if ( preg_match( '/^' . preg_quote( $user->getName(), '/' ) . '\//', $this->mTextform ) ) {
+                               if ( $this->isCssSubpage() && !$user->isAllowedAny( 'editmyusercss', 'editusercss' ) ) {
+                                       $errors[] = array( 'mycustomcssprotected' );
+                               } elseif ( $this->isJsSubpage() && !$user->isAllowedAny( 'editmyuserjs', 'edituserjs' ) ) {
+                                       $errors[] = array( 'mycustomjsprotected' );
+                               }
+                       } else {
+                               if ( $this->isCssSubpage() && !$user->isAllowed( 'editusercss' ) ) {
+                                       $errors[] = array( 'customcssprotected' );
+                               } elseif ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) {
+                                       $errors[] = array( 'customjsprotected' );
+                               }
                        }
                }
 
@@ -2242,36 +2249,6 @@ class Title {
                return $errors;
        }
 
-       /**
-        * Protect css subpages of user pages: can $wgUser edit
-        * this page?
-        *
-        * @deprecated in 1.19; use getUserPermissionsErrors() instead.
-        * @return Bool
-        */
-       public function userCanEditCssSubpage() {
-               global $wgUser;
-               wfDeprecated( __METHOD__, '1.19' );
-               return ( ( $wgUser->isAllowedAll( 'editusercssjs', 'editusercss' ) )
-                       || preg_match( '/^' . preg_quote( $wgUser->getName(), '/' ) . '\//', $this->mTextform ) );
-       }
-
-       /**
-        * Protect js subpages of user pages: can $wgUser edit
-        * this page?
-        *
-        * @deprecated in 1.19; use getUserPermissionsErrors() instead.
-        * @return Bool
-        */
-       public function userCanEditJsSubpage() {
-               global $wgUser;
-               wfDeprecated( __METHOD__, '1.19' );
-               return (
-                       ( $wgUser->isAllowedAll( 'editusercssjs', 'edituserjs' ) )
-                       || preg_match( '/^' . preg_quote( $wgUser->getName(), '/' ) . '\//', $this->mTextform )
-               );
-       }
-
        /**
         * Get a filtered list of all restriction types supported by this wiki.
         * @param bool $exists True to get all restriction types that apply to