From: Chad Horohoe Date: Mon, 28 Feb 2011 23:15:14 +0000 (+0000) Subject: Don't allow user to create a Project namespace that conflicts with existing namespaces X-Git-Tag: 1.31.0-rc.0~31714 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=cd2b5415fd0d54c5c88e4fba5a4b683674e83777;p=lhc%2Fweb%2Fwiklou.git Don't allow user to create a Project namespace that conflicts with existing namespaces --- diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index e60728f137..a3247de631 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -328,6 +328,8 @@ In '''UTF-8 mode''', MySQL will know what character set your data is in, and can All page titles in this namespace start with a certain prefix, which you can specify here. Traditionally, this prefix is derived from the name of the wiki, but it cannot contain punctuation characters such as "#" or ":".', 'config-ns-invalid' => 'The specified namespace "$1" is invalid. +Specify a different project namespace.', + 'config-ns-conflict' => 'The specified namespace "$1" conflicts with a default MediaWiki namespace. Specify a different project namespace.', 'config-admin-box' => 'Administrator account', 'config-admin-name' => 'Your name:', diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index afbd7c0959..090f03c678 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -666,6 +666,15 @@ class WebInstaller_Name extends WebInstallerPage { $this->parent->showError( 'config-ns-invalid', $name ); $retVal = false; } + + // Make sure it won't conflict with any existing namespaces + global $wgContLang; + $nsIndex = $wgContLang->getNsIndex( $name ); + if( $nsIndex !== false && $nsIndex !== NS_PROJECT ) { + $this->parent->showError( 'config-ns-conflict', $name ); + $retVal = false; + } + $this->setVar( 'wgMetaNamespace', $name ); // Validate username for creation