convert "::1" and other pseudo-IPv6 addresses that Apache may throw at us to their...
[lhc/web/wiklou.git] / includes / Title.php
index 55bda5c..76cf0eb 100644 (file)
@@ -162,7 +162,7 @@ class Title {
         * @static
         * @access public
         */
-       function newFromURL( $url ) {
+       public static function newFromURL( $url ) {
                global $wgLegalTitleChars;
                $t = new Title();
 
@@ -984,7 +984,7 @@ class Title {
         */
        function isProtected( $action = '' ) {
                global $wgRestrictionLevels;
-               if ( -1 == $this->mNamespace ) { return true; }
+               if ( NS_SPECIAL == $this->mNamespace ) { return true; }
                                
                if( $action == 'edit' || $action == '' ) {
                        $r = $this->getRestrictions( 'edit' );
@@ -1016,7 +1016,7 @@ class Title {
                global $wgUser;
 
                if ( is_null( $this->mWatched ) ) {
-                       if ( -1 == $this->mNamespace || 0 == $wgUser->getID()) {
+                       if ( NS_SPECIAL == $this->mNamespace || !$wgUser->isLoggedIn()) {
                                $this->mWatched = false;
                        } else {
                                $this->mWatched = $wgUser->isWatched( $this );
@@ -1164,8 +1164,7 @@ class Title {
                         * Always grant access to the login page.
                         * Even anons need to be able to log in.
                        */
-                       if( $this->getNamespace() == NS_SPECIAL
-                           && $this->getText() == 'Userlogin' ) {
+                       if( $this->isSpecial( 'Userlogin' ) ) {
                                return true;
                        }
 
@@ -1518,7 +1517,7 @@ class Title {
 
                # We already know that some pages won't be in the database!
                #
-               if ( '' != $this->mInterwiki || -1 == $this->mNamespace ) {
+               if ( '' != $this->mInterwiki || NS_SPECIAL == $this->mNamespace ) {
                        $this->mArticleID = 0;
                }
                $f = strstr( $r, '#' );
@@ -1551,16 +1550,6 @@ class Title {
                        return false;
                }
 
-               /**
-                * Pages whose titles start with / can confuse webservers
-                * and proxies. They can be unreachable with the pretty
-                * URLs. Forbid them explicitly.
-               */
-               if ( strpos( $r, '/') === 0 )
-               {
-                       return false;
-               }
-
                # We shouldn't need to query the DB for the size.
                #$maxSize = $dbr->textFieldSize( 'page', 'page_title' );
                if ( strlen( $r ) > 255 ) {
@@ -2308,7 +2297,7 @@ class Title {
         * @deprecated use DependencyWrapper
         */
        function getRelatedCache( $memc, $key, $expiry, $callback, $params = array() ) {
-               return DependencyWrapper::getValueFromCache( $memc, $key, $expiry, $callback,
+               return DependencyWrapper::getValueFromCache( $memc, $key, $expiry, $callback, 
                        $params, new TitleDependency( $this ) );
        }