X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSkin.php;h=24d48bc44c9ef626e25e599044a6882e63b733f1;hb=a5e33a4295d5a24b54058f245ce1f2fdacf2eaf8;hp=364d8c5bcad06f5db11eb1acf62fdb8ce16748eb;hpb=4ef471fc3196a383c36e6e41794bc31a49162e5f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 364d8c5bca..24d48bc44c 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -290,8 +290,8 @@ abstract class Skin extends ContextSource { return $this->mRelevantUser; } $title = $this->getRelevantTitle(); - if( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) { - $rootUser = strtok( $title->getText(), '/' ); + if( $title->hasSubjectNamespace( NS_USER ) ) { + $rootUser = $title->getRootText(); if ( User::isIP( $rootUser ) ) { $this->mRelevantUser = User::newFromName( $rootUser, false ); } else { @@ -1063,7 +1063,7 @@ abstract class Skin extends ContextSource { * @return String URL */ static function makeInternalOrExternalUrl( $name ) { - if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $name ) ) { + if ( preg_match( '/^(?i:' . wfUrlProtocols() . ')/', $name ) ) { return $name; } else { return self::makeUrl( $name ); @@ -1227,7 +1227,7 @@ abstract class Skin extends ContextSource { $text = $line[1]; } - if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) { + if ( preg_match( '/^(?i:' . wfUrlProtocols() . ')/', $link ) ) { $href = $link; // Parser::getExternalLinkAttribs won't work here because of the Namespace things @@ -1288,18 +1288,19 @@ abstract class Skin extends ContextSource { $ntl = ''; if ( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) { - $userTalkTitle = $this->getUser()->getTalkPage(); + $uTalkTitle = $this->getUser()->getTalkPage(); - if ( !$userTalkTitle->equals( $out->getTitle() ) ) { + if ( !$uTalkTitle->equals( $out->getTitle() ) ) { $lastSeenRev = isset( $newtalks[0]['rev'] ) ? $newtalks[0]['rev'] : null; $nofAuthors = 0; if ( $lastSeenRev !== null ) { $plural = true; // Default if we have a last seen revision: if unknown, use plural - $latestRev = Revision::newFromTitle ($userTalkTitle); + $latestRev = Revision::newFromTitle( $uTalkTitle, false, Revision::READ_NORMAL ); if ( $latestRev !== null ) { // Singular if only 1 unseen revision, plural if several unseen revisions. $plural = $latestRev->getParentId() !== $lastSeenRev->getId(); - $nofAuthors = $userTalkTitle->countAuthorsBetween( $lastSeenRev, $latestRev, 10, 'include_new' ); + $nofAuthors = $uTalkTitle->countAuthorsBetween( + $lastSeenRev, $latestRev, 10, 'include_new' ); } } else { // Singular if no revision -> diff link will show latest change only in any case @@ -1310,14 +1311,14 @@ abstract class Skin extends ContextSource { // the number of revisions or authors is not necessarily the same as the number of // "messages". $newMessagesLink = Linker::linkKnown( - $userTalkTitle, + $uTalkTitle, $this->msg( 'newmessageslinkplural' )->params( $plural )->escaped(), array(), array( 'redirect' => 'no' ) ); $newMessagesDiffLink = Linker::linkKnown( - $userTalkTitle, + $uTalkTitle, $this->msg( 'newmessagesdifflinkplural' )->params( $plural )->escaped(), array(), $lastSeenRev !== null @@ -1535,6 +1536,7 @@ abstract class Skin extends ContextSource { * * @param $fname String Name of called method * @param $args Array Arguments to the method + * @throws MWException * @return mixed */ function __call( $fname, $args ) {