}
/**
+ * THIS IS NOT THE FUNCTION YOU WANT. Use Title::newFromText().
+ *
+ * Example of wrong and broken code:
+ * $title = Title::newFromURL( $wgRequest->getVal( 'title' ) );
+ *
+ * Example of right code:
+ * $title = Title::newFromText( $wgRequest->getVal( 'title' ) );
+ *
* Create a new Title from URL-encoded text. Ensures that
* the given title's length does not exceed the maximum.
* @param $url \type{\string} the title, as might be taken from a URL
return trim( $t );
}
- /*
+ /**
* Make a prefixed DB key from a DB key and a namespace index
* @param $ns \type{\int} numerical representation of the namespace
* @param $title \type{\string} the DB key form the title
return $name;
}
- /**
- * Returns the URL associated with an interwiki prefix
- * @param $key \type{\string} the interwiki prefix (e.g. "MeatBall")
- * @return \type{\string} the associated URL, containing "$1",
- * which should be replaced by an article title
- * @static (arguably)
- * @deprecated See Interwiki class
- */
- public function getInterwikiLink( $key ) {
- return Interwiki::fetch( $key )->getURL( );
- }
-
/**
* Determine whether the object refers to a page within
* this project.
if( !$user->isAllowed( 'move' ) ) {
// User can't move anything
- $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
+ global $wgGroupPermissions;
+ if( $user->isAnon() && ( $wgGroupPermissions['user']['move']
+ || $wgGroupPermissions['autoconfirmed']['move'] ) ) {
+ // custom message if logged-in users without any special rights can move
+ $errors[] = array ( 'movenologintext' );
+ } else {
+ $errors[] = array ('movenotallowed');
+ }
}
} elseif ( $action == 'create' ) {
if( ( $this->isTalkPage() && !$user->isAllowed( 'createtalk' ) ) ||
} elseif( $action == 'move-target' ) {
if( !$user->isAllowed( 'move' ) ) {
// User can't move anything
- $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
+ $errors[] = array ('movenotallowed');
} elseif( !$user->isAllowed( 'move-rootuserpages' )
&& $this->getNamespace() == NS_USER && !$this->isSubpage() )
{
if( $create_perm ) {
$params = array("[create=$create_perm] $expiry_description",'');
- $log->addEntry( $this->mRestrictions['create'] ? 'modify' : 'protect', $this, trim( $reason ), $params );
+ $log->addEntry( ( isset( $this->mRestrictions['create'] ) && $this->mRestrictions['create'] ) ? 'modify' : 'protect', $this, trim( $reason ), $params );
} else {
$log->addEntry( 'unprotect', $this, $reason );
}
__METHOD__ );
}
- /**
- * Can $wgUser edit this page?
- * @return \type{\bool} TRUE or FALSE
- * @deprecated use userCan('edit')
- */
- public function userCanEdit( $doExpensiveQueries = true ) {
- return $this->userCan( 'edit', $doExpensiveQueries );
- }
-
- /**
- * Can $wgUser create this page?
- * @return \type{\bool} TRUE or FALSE
- * @deprecated use userCan('create')
- */
- public function userCanCreate( $doExpensiveQueries = true ) {
- return $this->userCan( 'create', $doExpensiveQueries );
- }
-
- /**
- * Can $wgUser move this page?
- * @return \type{\bool} TRUE or FALSE
- * @deprecated use userCan('move')
- */
- public function userCanMove( $doExpensiveQueries = true ) {
- return $this->userCan( 'move', $doExpensiveQueries );
- }
-
/**
* Would anybody with sufficient privileges be able to move this page?
* Some pages just aren't movable.
return $result;
}
- # Shortcut for public wikis, allows skipping quite a bit of code
- if ( !empty( $wgGroupPermissions['*']['read'] ) )
- return true;
-
if( $wgUser->isAllowed( 'read' ) ) {
return true;
} else {