X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=ec9840a228f2c84ff36afc61e0e9adc824dcb6ec;hb=417dd31ad26be38211ebedea21cd9fcff1affa9b;hp=58e688589f5fc532197cc3942c7c09716781e92d;hpb=28f57e9ef44cc3028e19a5c0aae84472e80f2519;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 58e688589f..ec9840a228 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1027,12 +1027,11 @@ class Title implements LinkTarget { */ public function getNsText() { if ( $this->isExternal() ) { - // This probably shouldn't even happen, - // but for interwiki transclusion it sometimes does. - // Use the canonical namespaces if possible to try to - // resolve a foreign namespace. - if ( MWNamespace::exists( $this->mNamespace ) ) { - return MWNamespace::getCanonicalName( $this->mNamespace ); + // This probably shouldn't even happen, except for interwiki transclusion. + // If possible, use the canonical name for the foreign namespace. + $nsText = MWNamespace::getCanonicalName( $this->mNamespace ); + if ( $nsText !== false ) { + return $nsText; } } @@ -2557,7 +2556,10 @@ class Title implements LinkTarget { return $errors; } - if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) { + if ( $wgEmailConfirmToEdit + && !$user->isEmailConfirmed() + && $action === 'edit' + ) { $errors[] = [ 'confirmedittext' ]; } @@ -4795,14 +4797,12 @@ class Title implements LinkTarget { */ public function getNamespaceKey( $prepend = 'nstab-' ) { global $wgContLang; - // Gets the subject namespace if this title - $namespace = MWNamespace::getSubject( $this->getNamespace() ); - // Checks if canonical namespace name exists for namespace - if ( MWNamespace::exists( $this->getNamespace() ) ) { - // Uses canonical namespace name - $namespaceKey = MWNamespace::getCanonicalName( $namespace ); - } else { - // Uses text of namespace + // Gets the subject namespace of this title + $subjectNS = MWNamespace::getSubject( $this->getNamespace() ); + // Prefer canonical namespace name for HTML IDs + $namespaceKey = MWNamespace::getCanonicalName( $subjectNS ); + if ( $namespaceKey === false ) { + // Fallback to localised text $namespaceKey = $this->getSubjectNsText(); } // Makes namespace key lowercase