Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/53286


Change subject: Apply title normalization for global groups.
......................................................................

Apply title normalization for global groups.

This wont break on wikimedia wikis as all groups yet are in the
normalized forms. I didn't built in a fancy error reporting as
these functions are barely used.

Change-Id: I80e3a3c62d7a9d333cf62bba4d3009b18008383f
---
M CentralAuth.i18n.php
M specials/SpecialGlobalGroupPermissions.php
2 files changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/86/53286/1

diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
index 54d746d..b1a336f 100644
--- a/CentralAuth.i18n.php
+++ b/CentralAuth.i18n.php
@@ -325,6 +325,7 @@
        'centralauth-editgroup-name'                      => 'Name of group:',
        'centralauth-editgroup-display'                   => 'Localised name of 
group:',
        'centralauth-editgroup-display-edit'              => '$2 
([[MediaWiki:Group-$1|edit]])',
+       'centralauth-editgroup-invalid-name'              => 'Invalid global 
group name given',
        'centralauth-editgroup-member'                    => 'Localised name of 
group members:',
        'centralauth-editgroup-member-edit'               => '$2 
([[MediaWiki:Group-$1-member|edit]])',
        'centralauth-editgroup-members'                   => 'Member list:',
@@ -724,6 +725,7 @@
 * {{msg-mw|Centralauth-rightslog-set-optin}}',
        'centralauth-autologin-desc' => 'This is the text shown on 
[[Special:AutoLogin]] when this page is requested by a user, not by the 
automatic global login system.',
        'centralauth-globalgroupperms-newgroupname' => 'I think this needs to 
be translated as "Name of the new group", not as "New name of the group". – 
[[User:McDutchie|McDutchie]] 16:40, 20 July 2008 (UTC)',
+       'centralauth-editgroup-invalid-name'              => 'Error shown in 
case the name given for the global group is invalid',
        'centralauth-editgroup-subtitle' => 'Subtitle for 
Special:GlobalGroupPernissions for users who may edit these permission.
 
 Parameters:
diff --git a/specials/SpecialGlobalGroupPermissions.php 
b/specials/SpecialGlobalGroupPermissions.php
index e7e21d3..0f992a0 100644
--- a/specials/SpecialGlobalGroupPermissions.php
+++ b/specials/SpecialGlobalGroupPermissions.php
@@ -273,9 +273,24 @@
                }
                $reason = $this->getRequest()->getVal( 'wpReason', '' );
 
+               // Current name of the group
+               $group = Title::newFromText( $group );
+               if ( !$group ) {
+                               $this->getOutput()->addWikiMsg( 
'centralauth-editgroup-invalid-name' );
+                               return;
+               }
+               $group = $group->getPrefixedDBkey();
 
-               // Global group rename
+               // (Potentially) New name of the group
                $newname = $this->getRequest()->getVal( 'wpGlobalGroupName', 
$group );
+
+               $newname = Title::newFromText( $newname );
+               if ( !$newname ) {
+                               $this->getOutput()->addWikiMsg( 
'centralauth-editgroup-invalid-name' );
+                               return;
+               }
+               $newname = $newname->getPrefixedDBkey();
+
                if ( $group != $newname ) {
 
                        if ( in_array( $newname, 
CentralAuthUser::availableGlobalGroups() ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/53286
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I80e3a3c62d7a9d333cf62bba4d3009b18008383f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to