r100368 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100367‎ | r100368 | r100369 >
Date:20:31, 20 October 2011
Author:ashley
Status:ok (Comments)
Tags:
Comment:
Modified paths:
  • /trunk/extensions/BatchUserRights (added) (history)
  • /trunk/extensions/BatchUserRights/BatchUserRights.alias.php (added) (history)
  • /trunk/extensions/BatchUserRights/BatchUserRights.i18n.php (added) (history)
  • /trunk/extensions/BatchUserRights/BatchUserRights.php (added) (history)
  • /trunk/extensions/BatchUserRights/SpecialBatchUserRights.php (added) (history)

Diff [purge]

Index: trunk/extensions/BatchUserRights/BatchUserRights.alias.php
@@ -0,0 +1,15 @@
 2+<?php
 3+/**
 4+ * Aliases for Special:BatchUserRights.
 5+ *
 6+ * @file
 7+ */
 8+
 9+$aliases = array();
 10+
 11+/** English
 12+ * @author Sean Colombo
 13+ */
 14+$aliases['en'] = array(
 15+ 'BatchUserRights' => array( 'BatchUserRights' ),
 16+);
\ No newline at end of file
Property changes on: trunk/extensions/BatchUserRights/BatchUserRights.alias.php
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: trunk/extensions/BatchUserRights/BatchUserRights.i18n.php
@@ -0,0 +1,398 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for the BatchUserRights extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English */
 13+$messages['en'] = array(
 14+ 'batchuserrights' => 'Batch user rights',
 15+ 'batchuserrights-desc' => 'Allows adding one or more users to a group in one action',
 16+ 'batchuserrights-names' => 'Usernames to add this group to (one per line):',
 17+ 'batchuserrights-intro' => 'This page will let you add a group to multiple users at once.
 18+For security reasons, the list of addable groups is set in the extension configuration and cannot be changed from within the wiki.
 19+Please ask a system administrator if you need to allow batch-adding of other groups.',
 20+ 'batchuserrights-single-progress-update' => 'Added {{PLURAL:$1|group|groups}} to <strong>$2</strong>.',
 21+ 'batchuserrights-add-groups' => 'Adding {{PLURAL:$1|one user|$1 users}} to the following {{PLURAL:$2|group|groups}}: <strong>$3</strong>.',
 22+ 'batchuserrights-userload-error' => "Could not load the user \"'''$1'''\".",
 23+ 'batchuserrights-no-groups' => 'You did not choose any groups.
 24+This will not accomplish anything.
 25+The rest of the page will be allowed to run just so that you can easily see if any of the usernames could not be loaded.',
 26+);
 27+
 28+/** Message documentation (Message documentation)
 29+ * @author The Evil IP address
 30+ */
 31+$messages['qqq'] = array(
 32+ 'batchuserrights-desc' => '{{desc}}',
 33+);
 34+
 35+/** Afrikaans (Afrikaans)
 36+ * @author Naudefj
 37+ */
 38+$messages['af'] = array(
 39+ 'batchuserrights-userload-error' => "Die gebruiker \"'''\$1'''\" kon nie gelaai word nie.",
 40+);
 41+
 42+/** Bulgarian (Български)
 43+ * @author DCLXVI
 44+ */
 45+$messages['bg'] = array(
 46+ 'batchuserrights-add-groups' => 'Добавяне на {{PLURAL:$1|един потребител|$1 потребителя}} в {{PLURAL:$2|следната група|следните групи}}: <strong>$3</strong>.',
 47+);
 48+
 49+/** Breton (Brezhoneg)
 50+ * @author Fohanno
 51+ * @author Y-M D
 52+ */
 53+$messages['br'] = array(
 54+ 'batchuserrights' => 'Gwirioù oberour dre strolladoù',
 55+ 'batchuserrights-desc' => "Aotreañ a ra da ouzhpennañ unan pe meur a implijer d'ur strollad en un obererezh hepken",
 56+ 'batchuserrights-names' => "Anvioù implijer da ouzhpennañ d'ar strollad-mañ (unan dre linenn) :",
 57+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|Strollad|Strolladoù}} ouzhpennet da <strong>$2</strong>.',
 58+ 'batchuserrights-add-groups' => "Ouzhpennañ {{PLURAL:$1|un implijer|$1 implijer}} d'ar {{PLURAL:$2|strollad|strolladoù}}-mañ : <strong>$3</strong>.",
 59+ 'batchuserrights-userload-error' => "Dibosupl eo kargañ an implijer \"'''\$1'''\".",
 60+);
 61+
 62+/** Bosnian (Bosanski)
 63+ * @author CERminator
 64+ */
 65+$messages['bs'] = array(
 66+ 'batchuserrights-desc' => 'Omogućava dodavanje jednog ili više korisnika u grupu putem jedne akcije',
 67+ 'batchuserrights-userload-error' => "Nisam mogao učitati korisnika \"'''\$1'''\".",
 68+);
 69+
 70+/** Czech (Česky)
 71+ * @author Dontlietome7
 72+ */
 73+$messages['cs'] = array(
 74+ 'batchuserrights' => 'Dávkové přidělení uživatelských práv',
 75+ 'batchuserrights-desc' => 'Umožňuje přidání jednoho nebo více uživatelů najednou do skupiny',
 76+ 'batchuserrights-names' => 'Uživatelská jména k přidání do této skupiny (1 na řádek):',
 77+ 'batchuserrights-intro' => 'Tato stránka vám umožní přidat skupinu pro více uživatelů najednou.
 78+Z bezpečnostních důvodů seznam přidatelných skupin je nastaven v konfiguraci rozšíření a nelze jej měnit v rámci wiki.
 79+Požádejte správce systému, pokud potřebujete povolit dávkové přidáním dalších skupin.',
 80+ 'batchuserrights-single-progress-update' => 'Přidána {{PLURAL:$1|skupina|skupiy|skupin}} do <strong>$2</strong>.',
 81+ 'batchuserrights-add-groups' => 'Přidávání {{PLURAL:$1|jednoho uževatele|$1 uživatelů}} do následující{{PLURAL:$2| skupiny|ch skupin}}: <strong>$3</strong>.',
 82+ 'batchuserrights-userload-error' => "Nelze načíst uživatele \"'''\$1'''\".",
 83+ 'batchuserrights-no-groups' => 'Neurčili jste žádné skupiny.
 84+Neprovede se žádná akce.
 85+Zbývající část stránky bude možné spustit tak, že lze snadno zobrazit, pokud některého z uživatelů nelze načíst.',
 86+);
 87+
 88+/** German (Deutsch)
 89+ * @author LWChris
 90+ * @author SVG
 91+ * @author The Evil IP address
 92+ */
 93+$messages['de'] = array(
 94+ 'batchuserrights' => 'Massen-Benutzerrechte',
 95+ 'batchuserrights-desc' => 'Einen oder mehrere Benutzer in einer Aktion einer Gruppe hinzufügen',
 96+ 'batchuserrights-names' => 'Folgende Benutzer dieser Gruppe hinzufügen (einer pro Zeile):',
 97+ 'batchuserrights-intro' => 'Auf dieser Seite kannst du mehrere Benutzern gleichzeitig einer Gruppe hinzufügen.
 98+Aus Sicherheitsgründen ist die Liste der hinzufügbaren Gruppen in der Erweiterungs-Konfiguration festgelegt und kann im Wiki nicht verändert werden.
 99+Bitte wende dich an einen Systemadministrator, falls du andere Gruppen für das Hinzufügen benötigst.',
 100+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|Gruppe|Gruppen}} <strong>$2</strong> hinzugefügt.',
 101+ 'batchuserrights-add-groups' => '{{PLURAL:$1|Ein Benutzer|$1 Benutzer}} wird {{PLURAL:$2|der folgenden Gruppe|den folgenden Gruppen}} hinzugefügt: <strong>$3</strong>',
 102+ 'batchuserrights-userload-error' => "Konnte den Benutzer „'''$1'''“ nicht laden.",
 103+ 'batchuserrights-no-groups' => 'Du hast keine Gruppen ausgewählt.
 104+Dies wird nichts verändern.
 105+Der Rest der Seite wird nur geladen, sodass du einfach sehen kannst ob einer der Benutzer nicht geladen werden konnte.',
 106+);
 107+
 108+/** Spanish (Español)
 109+ * @author Bola
 110+ * @author Sanbec
 111+ */
 112+$messages['es'] = array(
 113+ 'batchuserrights' => 'Derechos de usuarios por lotes',
 114+ 'batchuserrights-desc' => 'Permite añadir uno o más usuarios a un grupo en una sola acción',
 115+ 'batchuserrights-names' => 'Nombres de usuario para añadir a este grupo (uno por línea):',
 116+ 'batchuserrights-intro' => 'Esta página te permitirá añadir a un grupo múltiples usuarios a la vez.
 117+Por razones de seguridad, la lista de grupos agregables se cambia en la configuración de la extensión y no puede ser cambiada desde dentro del wiki.
 118+Por favor, pregunta a un administrador del sistema si necesitas añadir otros grupos.',
 119+ 'batchuserrights-single-progress-update' => 'Añadido {{PLURAL:$1|grupo|grupos}} a <strong>$2</strong>.',
 120+ 'batchuserrights-add-groups' => 'Añadiendo {{PLURAL:$1|un usuario|$1 usuarios}} {{PLURAL:$2|al siguiente grupo|a los siguientes grupos}}: <strong>$3</strong>.',
 121+ 'batchuserrights-userload-error' => "No se pudo cargar el usuario \"'''\$1'''\".",
 122+ 'batchuserrights-no-groups' => 'No elegiste ningún grupo.
 123+De esta forma no ocurrirá nada.
 124+El resto de la página será ejecutada solo para que puedas ver fácilmente si algún nombre de usuario no se puede cargar.',
 125+);
 126+
 127+/** French (Français)
 128+ * @author Peter17
 129+ */
 130+$messages['fr'] = array(
 131+ 'batchuserrights' => 'Droits d’utilisateurs par lots',
 132+ 'batchuserrights-desc' => 'Permet d’ajouter un ou plusieurs utilisateur(s) à un groupe en une seule action',
 133+ 'batchuserrights-names' => 'Noms d’utilisateurs à ajouter à ce groupe (un par ligne) :',
 134+ 'batchuserrights-intro' => 'Cette page permet d’ajouter un groupe à plusieurs utilisateurs en une fois.
 135+Pour des raisons de sécurité, la liste des groupes utilisables est définie dans la configuration de l’extension et ne peut pas être changée depuis l’interface du wiki.
 136+Si vous voulez autoriser l’ajout par lots pour d’autres groupes, veuillez demander leur ajout à un administrateur système.',
 137+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|groupe ajouté|groupes ajoutés}} à <strong>$2</strong>.',
 138+ 'batchuserrights-add-groups' => 'Ajout {{PLURAL:$1|d’un utilisateur|de $1 utilisateurs}} {{PLURAL:$2|au groupe suivant|aux groupes suivants}} : <strong>$3</strong>.',
 139+ 'batchuserrights-userload-error' => "Impossible de charger l’utilisateur « '''$1''' ».",
 140+ 'batchuserrights-no-groups' => 'Vous n’avez choisi aucun groupe.
 141+Aucune action ne sera effectuée.
 142+Le reste de la page se chargera normalement ce qui vous permettra de voir si certains noms d’utilisateurs ne peuvent pas être chargés.',
 143+);
 144+
 145+/** Galician (Galego)
 146+ * @author Toliño
 147+ */
 148+$messages['gl'] = array(
 149+ 'batchuserrights' => 'Dereitos de usuario en feixe',
 150+ 'batchuserrights-desc' => 'Permite engadir un ou máis usuarios a un grupo cunha soa acción',
 151+ 'batchuserrights-names' => 'Nomes de usuario a engadir a este grupo (un por liña):',
 152+ 'batchuserrights-intro' => 'Esta páxina permitirá engadir usuarios a un grupo ao mesmo tempo.
 153+Por razóns de seguridade, a lista dos grupos que se poden engadir está definida na configuración da extensión e non se pode cambiar dentro do wiki.
 154+Por favor, pregunte a un administrador do sistema se necesita engadir outros grupos.',
 155+ 'batchuserrights-single-progress-update' => 'Engadiu {{PLURAL:$1|un grupo|grupos}} a <strong>$2</strong>.',
 156+ 'batchuserrights-add-groups' => 'Engadiu {{PLURAL:$1|un usuario|$1 usuarios}} {{PLURAL:$2|ao seguinte grupo|aos seguintes grupos}}: <strong>$3</strong>.',
 157+ 'batchuserrights-userload-error' => "Non se puido cargar o usuario \"'''\$1'''\".",
 158+ 'batchuserrights-no-groups' => 'Non elixiu ningún grupo.
 159+Deste modo, non ocorrerá nada.
 160+Que apareza o resto da páxina só serve para que poida ollar facilmente se non se puido cargar algún dos nomes de usuario.',
 161+);
 162+
 163+/** Interlingua (Interlingua)
 164+ * @author McDutchie
 165+ */
 166+$messages['ia'] = array(
 167+ 'batchuserrights' => 'Derectos de usator in lot',
 168+ 'batchuserrights-desc' => 'Permitte adder un o plus usatores a un gruppo in un sol action',
 169+ 'batchuserrights-names' => 'Nomines de usator al quales adder iste gruppo (un per linea):',
 170+ 'batchuserrights-intro' => 'Iste pagina te permitte adder un gruppo a plure usatores insimul.
 171+Pro motivos de securitate, le lista de gruppos addibile es definite in le configuration del extension e non pote esser cambiate ab intra le wiki.
 172+Per favor demanda lo a un administrator de systema si tu ha besonio de permitter le addition in lot de altere gruppos.',
 173+ 'batchuserrights-single-progress-update' => 'Addeva {{PLURAL:$1|gruppo|gruppos}} a <strong>$2</strong>.',
 174+ 'batchuserrights-add-groups' => 'Adde {{PLURAL:$1|un usator|$1 usator}} al sequente {{PLURAL:$2|gruppo|gruppos}}: <strong>$3</strong>.',
 175+ 'batchuserrights-userload-error' => "Non poteva cargar le usator \"'''\$1'''\".",
 176+ 'batchuserrights-no-groups' => 'Tu non seligeva alcun gruppo.
 177+Isto va complir nihil.
 178+Le resto del pagina essera executate solmente a fin que tu pote vider facilemente si alcun del nomines de usator non poteva esser cargate.',
 179+);
 180+
 181+/** Luxembourgish (Lëtzebuergesch)
 182+ * @author Robby
 183+ */
 184+$messages['lb'] = array(
 185+ 'batchuserrights' => 'Benotzerrechter automatiséieren',
 186+ 'batchuserrights-desc' => 'Erlaabt et een oder méi Benotzer an enger Aktioun an e Grupp derbäizesetzen',
 187+ 'batchuserrights-names' => 'Benotzernimm fir an dëse Grupp derbäizesetzen (e pro Linn):',
 188+ 'batchuserrights-userload-error' => "De Benotzer \"'''\$1'''\" konnt net geluede ginn.",
 189+);
 190+
 191+/** Lithuanian (Lietuvių)
 192+ * @author Eitvys200
 193+ */
 194+$messages['lt'] = array(
 195+ 'batchuserrights-single-progress-update' => 'Pridėta {{PLURAL:$1| grupė | grupės}} į <strong>$2</strong> .',
 196+ 'batchuserrights-userload-error' => "Nepavyko įkelti naudotojo \"''' \$1 '''\".",
 197+);
 198+
 199+/** Macedonian (Македонски)
 200+ * @author Bjankuloski06
 201+ */
 202+$messages['mk'] = array(
 203+ 'batchuserrights' => 'Групни кориснички права',
 204+ 'batchuserrights-desc' => 'Овозможува додавање на еден или повеќе корисници во група наеднаш',
 205+ 'batchuserrights-names' => 'Кориснички имиња кон кои треба да се додаде оваа група (по едно во секој ред):',
 206+ 'batchuserrights-intro' => 'Оваа страница ви овозможува да додадете група кон повеќе корисници наеднаш.
 207+Од безбедносни причини, списокот на групи што може да се додаваат е сместена во поставките на додатокот и не може да се промени од викито.
 208+Прашајте го системскиот администратор дали треба да дозволите групно додавање на други групи.',
 209+ 'batchuserrights-single-progress-update' => 'Додадени {{PLURAL:$1|група|групи}} кон <strong>$2</strong>.',
 210+ 'batchuserrights-add-groups' => '{{PLURAL:$1|Се додава еден корисник|Се додаваат $1 корисници}} кон {{PLURAL:$2|следнава група|следниве групи}}: <strong>$3</strong>.',
 211+ 'batchuserrights-userload-error' => "Не можев да го вчитам корисникот „'''$1'''“.",
 212+ 'batchuserrights-no-groups' => 'Не одбравте ниедна група.
 213+Со ова нема да постигнете ништо.
 214+Остатокот од страницата ќе работи и понатаму за да можете лесно да видите дали некое корисничко име не можело да се вчита.',
 215+);
 216+
 217+/** Malay (Bahasa Melayu)
 218+ * @author Anakmalaysia
 219+ */
 220+$messages['ms'] = array(
 221+ 'batchuserrights' => 'Hak pengguna kelompok',
 222+ 'batchuserrights-desc' => 'Membolehkan penambahan lebih daripada satu pengguna ke dalam sesebuah kumpulan dengan sekali tindakan',
 223+ 'batchuserrights-names' => 'Nama-nama pengguna untuk disertakan ke dalam kumpulan ini (seorang sebaris):',
 224+ 'batchuserrights-intro' => 'Laman ini akan membolehkan anda menyertakan lebih daripada satu pengguna ke dalam satu kumpulan sekaligus.
 225+Demi keselamatan, senarai kumpulan yang boleh ditambah itu ditetapkan dalam tatarajah sambungan dan tidak boleh diubah dari dalam wiki.
 226+Sila tanya pentadbir sistem jika anda perlu membenarkan penambahan kumpulan lain secara berkelompok.',
 227+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|Kumpulan|Kumpulan-kumpulan}} ditambahkan ke dalam <strong>$2</strong>.',
 228+ 'batchuserrights-add-groups' => '{{PLURAL:$1|Seorang pengguna|$1 orang pengguna}} sedang ditambahkan ke dalam {{PLURAL:$2|kumpulan|kumpulan-kumpulan}} berikut: <strong>$3</strong>.',
 229+ 'batchuserrights-userload-error' => "Pengguna \"'''\$1'''\" tidak dapat dimuatkan.",
 230+ 'batchuserrights-no-groups' => 'Anda belum memilih mana-mana kumpulan.
 231+Ini tidak akan mendatangkan sebarang hasil.
 232+Yang selebihnya dalam laman ini akan dibenarkan berjalan supaya anda mudah melihat sama ada terdapat nama pengguna yang tidak dapat dimuatkan.',
 233+);
 234+
 235+/** Dutch (Nederlands)
 236+ * @author McDutchie
 237+ * @author Siebrand
 238+ */
 239+$messages['nl'] = array(
 240+ 'batchuserrights' => 'Gebruikersrechtenbeheer (en masse)',
 241+ 'batchuserrights-desc' => 'Maakt het toevoegen van meerdere gebruikers aan een groep in één handeling mogelijk',
 242+ 'batchuserrights-names' => 'Gebruikersnamen om deze groep aan toe te voegen (één per regel):',
 243+ 'batchuserrights-intro' => 'Via deze pagina kunt u meerdere gebruikers tegelijkertijd aan een groep toevoegen.
 244+Om beveiligingsredenen wordt de lijst met beschikbare groepen ingesteld in de instellingen van de uitbreiding en deze groepen kunnen niet vanuit de wiki gewijzigd worden.
 245+Vraag hulp van een systeembeheerder als u de beschikbare groepen wilt wijzigen.',
 246+ 'batchuserrights-single-progress-update' => 'De {{PLURAL:$1|groep is|groepen zijn}} toegevoegd aan <strong>$2</strong>.',
 247+ 'batchuserrights-add-groups' => 'Bezig met het toevoegen van {{PLURAL:$1|één gebruiker|$1 gebruikers}} aan de volgende {{PLURAL:$2|groep|groepen}}: <strong>$3</strong>.',
 248+ 'batchuserrights-userload-error' => "De gebruiker \"'''\$1'''\" kon niet geladen worden.",
 249+ 'batchuserrights-no-groups' => 'U hebt geen groepen gekozen.
 250+Nu wordt er niets uitgevoerd.
 251+De rest van de pagina kan uitgevoerd worden zodat u eenvoudig kunt zien of een van de gebruikersnamen niet geladen kon worden.',
 252+);
 253+
 254+/** ‪Nederlands (informeel)‬ (‪Nederlands (informeel)‬)
 255+ * @author Siebrand
 256+ */
 257+$messages['nl-informal'] = array(
 258+ 'batchuserrights-intro' => 'Via deze pagina kan je meerdere gebruikers tegelijkertijd aan een groep toevoegen.
 259+Om beveiligingsredenen wordt de lijst met beschikbare groepen ingesteld in de instellingen van de uitbreiding en deze groepen kunnen niet vanuit de wiki gewijzigd worden.
 260+Vraag hulp van een systeembeheerder als je de beschikbare groepen wilt wijzigen.',
 261+ 'batchuserrights-no-groups' => 'Je hebt geen groepen gekozen.
 262+Nu wordt er niets uitgevoerd.
 263+De rest van de pagina kan uitgevoerd worden zodat je eenvoudig kunt zien of een van de gebruikersnamen niet geladen kon worden.',
 264+);
 265+
 266+/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
 267+ * @author Audun
 268+ * @author Nghtwlkr
 269+ */
 270+$messages['no'] = array(
 271+ 'batchuserrights' => 'Puljeoppdater brukerrettigheter',
 272+ 'batchuserrights-desc' => 'Tillater å legge én eller flere brukere til en gruppe i én handling',
 273+ 'batchuserrights-names' => 'Brukernavn som skal legges til denne gruppen (ett per linje):',
 274+ 'batchuserrights-intro' => 'Denne siden lar deg legge flere brukere til en gruppe samtidig.
 275+Av sikkerhetsmessige årsaker, er listen over mulige grupper satt i utvidelseskonfigurasjonen og kan ikke endres fra wikien.
 276+Vennligst spør en systemadministrator hvis du har behov for å tillate puljetillegging av andre grupper.',
 277+ 'batchuserrights-single-progress-update' => 'Lagt {{PLURAL:$1|gruppe|grupper}} til <strong>$2</strong>.',
 278+ 'batchuserrights-add-groups' => 'Legger {{PLURAL:$1|én bruker|$1 brukere}} til {{PLURAL:$2|den|de}} følgende {{PLURAL:$2|gruppen|gruppene}}: <strong>$3</strong>.',
 279+ 'batchuserrights-userload-error' => "Kunne ikke laste brukeren «'''$1'''».",
 280+ 'batchuserrights-no-groups' => 'Du valgte ingen grupper.
 281+Dette vil ikke oppnå noe.
 282+Resten av siden vil få lov til å kjøre slik at du enkelt kan se om noen av brukernavnene ikke kunnes lastes.',
 283+);
 284+
 285+/** Piedmontese (Piemontèis)
 286+ * @author Borichèt
 287+ * @author Dragonòt
 288+ */
 289+$messages['pms'] = array(
 290+ 'batchuserrights' => "Drit ëd j'utent për partìe",
 291+ 'batchuserrights-desc' => "A përmët ëd gionté un o pi utent a na partìa con n'assion sola",
 292+ 'batchuserrights-names' => "Stranòm d'utent da gionté a costa partìa (un për linia):",
 293+ 'batchuserrights-intro' => "Sta pàgina a-j përmëttrà ëd gionté na partìa a vàire utent ant un colp.
 294+Për rason ëd sicurëssa, la lista ëd partìe giontàbij a l'é ampostà ant la configurassion ëd l'estension e a peul pa esse cangià d'andrinta a la wiki.
 295+Për piasì, ch'a ciama a n'aministrator ëd sistema s'a l'ha dabzògn ëd gionté a mucc d'àutre partìe.",
 296+ 'batchuserrights-single-progress-update' => 'Giontà {{PLURAL:$1|partìa|partìe}} a <strong>$2</strong>.',
 297+ 'batchuserrights-add-groups' => "Gionté {{PLURAL:$1|n'utent|$1 utent}} a {{PLURAL:$2|la partìa|le partìe}} sì-dapress: <strong>$3</strong>.",
 298+ 'batchuserrights-userload-error' => "As peul pa carié l'utent \"'''\$1'''\".",
 299+ 'batchuserrights-no-groups' => "A l'ha sernù gnun-e partìe.
 300+A sarà fàit gnente.
 301+Ël rest ëd la pàgina a podrà giré mach an manera ch'a vëdda facilment se quaidun djë stranòm d'utent a peulo pa esse carià.",
 302+);
 303+
 304+/** Portuguese (Português)
 305+ * @author Hamilton Abreu
 306+ * @author Waldir
 307+ */
 308+$messages['pt'] = array(
 309+ 'batchuserrights' => 'Direitos de utilizador em lote',
 310+ 'batchuserrights-desc' => 'Permite adicionar um ou mais utilizadores a um grupo de uma só vez',
 311+ 'batchuserrights-names' => 'Nomes de utilizador a adicionar a este grupo (um por linha):',
 312+ 'batchuserrights-intro' => 'Esta página permite atribuir um grupo a vários utilizadores ao mesmo tempo.
 313+Por razões de segurança, a lista dos grupos assim atribuíveis é definida na configuração da extensão e não pode ser alterada dentro da wiki.
 314+Se precisa de acrescentar mais grupos atribuíveis, peça a um administrador.',
 315+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|O grupo foi atribuído|Os grupos foram atribuídos}} a <strong>$2</strong>.',
 316+ 'batchuserrights-add-groups' => 'A adicionar {{PLURAL:$1|um utilizador|$1 utilizadores}} {{PLURAL:$2|ao seguinte grupo|aos seguintes grupos}}: <strong>$3</strong>.',
 317+ 'batchuserrights-userload-error' => "Não foi possível carregar o utilizador \"'''\$1'''\".",
 318+ 'batchuserrights-no-groups' => 'Não escolheu nenhum grupo.
 319+Isto não terá qualquer efeito.
 320+Será permitida a execução do resto da página apenas para que possa verificar se não foi possível carregar algum dos utilizadores.',
 321+);
 322+
 323+/** Brazilian Portuguese (Português do Brasil)
 324+ * @author Giro720
 325+ */
 326+$messages['pt-br'] = array(
 327+ 'batchuserrights' => 'Direitos de usuários em lote',
 328+ 'batchuserrights-desc' => 'Permite adicionar um ou mais usuários a um grupo de uma só vez',
 329+ 'batchuserrights-names' => 'Nomes de usuários a adicionar a este grupo (um por linha):',
 330+ 'batchuserrights-intro' => 'Esta página permite atribuir um grupo a vários usuários ao mesmo tempo.
 331+Por razões de segurança, a lista dos grupos assim atribuíveis é definida na configuração da extensão e não pode ser alterada dentro da wiki.
 332+Se você precisar acrescentar mais grupos atribuíveis, peça a um administrador.',
 333+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|O grupo foi atribuído|Os grupos foram atribuídos}} a <strong>$2</strong>.',
 334+ 'batchuserrights-add-groups' => 'A adicionar {{PLURAL:$1|um usuário|$1 usuários}} {{PLURAL:$2|ao seguinte grupo|aos seguintes grupos}}: <strong>$3</strong>.',
 335+ 'batchuserrights-userload-error' => "Não foi possível carregar o usuário \"'''\$1'''\".",
 336+ 'batchuserrights-no-groups' => 'Você não escolheu nenhum grupo.
 337+Isto não terá qualquer efeito.
 338+Será permitida a execução do resto da página apenas para que você possa verificar se não foi possível carregar algum dos usuários.',
 339+);
 340+
 341+/** Russian (Русский)
 342+ * @author Александр Сигачёв
 343+ */
 344+$messages['ru'] = array(
 345+ 'batchuserrights' => 'Пакетное управление правами участников',
 346+ 'batchuserrights-desc' => 'Позволяет добавлять нескольких участников в группу за одно действие',
 347+ 'batchuserrights-names' => 'Учётные записи, для включения в группу (по одному на строке):',
 348+ 'batchuserrights-intro' => 'Эта страница позволяет добавить группу в сразу несколько участников.
 349+По соображениям безопасности, список обрабатываемых групп устанавливается в настройках расширения и не может быть изменён в вики.
 350+Пожалуйста, обратитесь к системному администратору, если вы хотите включить пакетное добавление для других групп.',
 351+ 'batchuserrights-single-progress-update' => '{{PLURAL:$1|Добавлена группа|Добавлены группы}} для <strong>$2</strong>.',
 352+ 'batchuserrights-add-groups' => 'Добавление {{PLURAL:$1|$1 участника|$1 участников|$1 участников}} в {{PLURAL:$2|следующую группу|следующие группы}}: <strong>$3</strong>.',
 353+ 'batchuserrights-userload-error' => "Не удалось загрузить участника '''«$1»'''.",
 354+ 'batchuserrights-no-groups' => 'Вы не выбрали группы.
 355+Ничего не будет выполнено.
 356+Оставшаяся часть страницы будет обработана, чтобы показать какие учётные записи не могут быть загружены.',
 357+);
 358+
 359+/** Swedish (Svenska)
 360+ * @author WikiPhoenix
 361+ */
 362+$messages['sv'] = array(
 363+ 'batchuserrights-single-progress-update' => 'Lade till {{PLURAL:$1|grupp|grupperna}} till <strong>$2</strong>.',
 364+ 'batchuserrights-userload-error' => "Kunde inte läsa in användaren \"'''\$1'''\".",
 365+);
 366+
 367+/** Tagalog (Tagalog)
 368+ * @author AnakngAraw
 369+ */
 370+$messages['tl'] = array(
 371+ 'batchuserrights' => 'Mga karapatan ng tagagamit ng langkay',
 372+ 'batchuserrights-desc' => 'Nagpapahintulot ng pagdaragdag ng isa o mas marami pang mga tagagamit sa isang pangkat sa pamamagitan ng isang galaw',
 373+ 'batchuserrights-names' => 'Mga pangalan ng tagagamit na pagdaragdagan ng pangkat na ito (isa bawat guhit):',
 374+ 'batchuserrights-intro' => 'Ang pahinang ito ay kaagad na magpapahintulot sa iyo na magdagdag ng isang pangkat sa maramihang mga tagagamit.
 375+Para sa mga kadahilanang pangkaligtasan, ang talaan ng maidaragdag na mga pangkat ay nakatakda sa kaayusan ng dugtong at hindi mababago sa loob ng wiki.
 376+Mangyaring makipag-ugnayan sa isang tagapangasiwa ng sistema kung kailangan mong pahintulutan ang pagdaragdag ng langkay ng ibang mga pangkat.',
 377+ 'batchuserrights-single-progress-update' => 'Nagdagdag ng {{PLURAL:$1|pangkat|mga pangkat}} sa <strong>$2</strong>.',
 378+ 'batchuserrights-add-groups' => 'Nagdaragdag ng {{PLURAL:$1|isang tagagamit|$1 mga tagagamit}} sa sumusunod na {{PLURAL:$2|pangkat|mga pangkat}}: <strong>$3</strong>.',
 379+ 'batchuserrights-userload-error' => "Hindi maikarga ang tagagamit na \"'''\$1'''\".",
 380+ 'batchuserrights-no-groups' => 'Hindi ka pumili ng alin mang mga pangkat.
 381+Hindi ito makagagawa ng anumang bagay.
 382+Ang natitirang bahagi ng pahina ay papahintulutang tumakbo upang maginhawa mong makita kung ang alin man sa mga pangalan ng tagagamit ay hindi maikakarga.',
 383+);
 384+
 385+/** Ukrainian (Українська)
 386+ * @author Тест
 387+ */
 388+$messages['uk'] = array(
 389+ 'batchuserrights-desc' => 'Дозволяє додавати одного або декількох користувачів в групу за одну дію',
 390+);
 391+
 392+/** Simplified Chinese (‪中文(简体)‬)
 393+ * @author Hydra
 394+ */
 395+$messages['zh-hans'] = array(
 396+ 'batchuserrights' => '批处理的用户权限',
 397+ 'batchuserrights-desc' => '允许将一个或多个用户添加到一个操作中的一个组',
 398+);
 399+
Property changes on: trunk/extensions/BatchUserRights/BatchUserRights.i18n.php
___________________________________________________________________
Added: svn:eol-style
1400 + native
Index: trunk/extensions/BatchUserRights/BatchUserRights.php
@@ -0,0 +1,35 @@
 2+<?php
 3+/**
 4+ * Special page to allow adding user group membership to a large number of users at once.
 5+ * (such as adding a couple of hundred people to the "beta" user group).
 6+ *
 7+ * @file
 8+ * @ingroup SpecialPage
 9+ * @version 1.1 (r43851)
 10+ * @author Sean Colombo
 11+ * @link http://www.mediawiki.org/wiki/Extension:BatchUserRights Documentation
 12+ */
 13+if ( !defined( 'MEDIAWIKI' ) ) {
 14+ die();
 15+}
 16+
 17+// Extension credits that will show up on Special:Version
 18+$wgExtensionCredits['specialpage'][] = array(
 19+ 'name' => 'BatchUserRights',
 20+ 'version' => '1.1',
 21+ 'author' => '[http://www.seancolombo.com Sean Colombo]',
 22+ 'descriptionmsg' => 'batchuserrights-desc',
 23+ 'url' => 'http://www.mediawiki.org/wiki/Extension:BatchUserRights',
 24+);
 25+
 26+set_time_limit( 0 );
 27+// New user right, required to access Special:BatchUserRights
 28+$wgAvailableRights[] = 'batchuserrights';
 29+$wgGroupPermissions['bureaucrat']['batchuserrights'] = true;
 30+
 31+// Set up the new special page
 32+$dir = dirname( __FILE__ ) . '/';
 33+$wgExtensionMessagesFiles['BatchUserRights'] = $dir . 'BatchUserRights.i18n.php';
 34+$wgExtensionMessagesFiles['BatchUserRightsAliases'] = $dir . 'BatchUserRights.alias.php';
 35+$wgAutoloadClasses['SpecialBatchUserRights'] = $dir . 'SpecialBatchUserRights.php';
 36+$wgSpecialPages['BatchUserRights'] = 'SpecialBatchUserRights';
\ No newline at end of file
Property changes on: trunk/extensions/BatchUserRights/BatchUserRights.php
___________________________________________________________________
Added: svn:eol-style
137 + native
Index: trunk/extensions/BatchUserRights/SpecialBatchUserRights.php
@@ -0,0 +1,571 @@
 2+<?php
 3+/**
 4+ * A class to manage user levels rights.
 5+ *
 6+ * @file
 7+ * @ingroup SpecialPage
 8+ */
 9+class SpecialBatchUserRights extends SpecialPage {
 10+ protected $isself = false;
 11+
 12+ // For added security, this array will be the only groups we'll allow to be batch-added to users.
 13+ private static $grantableUserGroups = array(
 14+ 'beta',
 15+ 'rollback',
 16+ );
 17+
 18+ /**
 19+ * Constructor -- set up the new (restricted) special page
 20+ */
 21+ public function __construct() {
 22+ parent::__construct( 'BatchUserRights', 'batchuserrights' );
 23+ }
 24+
 25+ public function userCanExecute( $user ) {
 26+ return $this->userCanChangeRights( $user, false );
 27+ }
 28+
 29+ public function userCanChangeRights( $user, $checkIfSelf = true ) {
 30+ $available = $this->changeableGroups();
 31+ return !empty( $available['add'] ) ||
 32+ !empty( $available['remove'] ) ||
 33+ ( ( $this->isself || !$checkIfSelf ) &&
 34+ ( !empty( $available['add-self'] ) ||
 35+ !empty( $available['remove-self'] ) ) );
 36+ }
 37+
 38+ /**
 39+ * Manage forms to be shown according to posted data.
 40+ * Depending on the submit button used, call a form or a save function.
 41+ *
 42+ * @param $par Mixed: string if any subpage provided, else null
 43+ */
 44+ public function execute( $par ) {
 45+ global $wgUser, $wgRequest, $wgOut;
 46+
 47+ // If the visitor doesn't have permissions to assign or remove
 48+ // any groups, it's a bit silly to give them the user search prompt.
 49+ if ( !$wgUser->isAllowed( 'batchuserrights' ) ) {
 50+ $this->displayRestrictionError();
 51+ return;
 52+ }
 53+
 54+ if ( !$this->userCanChangeRights( $wgUser, true ) ) {
 55+ // @todo FIXME: there may be intermediate groups we can mention.
 56+ $wgOut->showPermissionsErrorPage( array(
 57+ $wgUser->isAnon()
 58+ ? 'userrights-nologin'
 59+ : 'userrights-notallowed' ) );
 60+ return;
 61+ }
 62+
 63+ // check if user is blocked -- see rt#19111
 64+ if ( $wgUser->isBlocked() ) {
 65+ $wgOut->blockedPage();
 66+ return;
 67+ }
 68+
 69+ if ( wfReadOnly() ) {
 70+ $wgOut->readOnlyPage();
 71+ return;
 72+ }
 73+
 74+ $this->outputHeader();
 75+
 76+ $this->setHeaders();
 77+
 78+ if ( $wgRequest->wasPosted() ) {
 79+ // Get the array of posted usernames (line-break delimited).
 80+ $usernames = explode( "\n", $wgRequest->getVal( 'wpUsernames', '' ) );
 81+
 82+ // save settings
 83+ if ( $wgRequest->getCheck( 'saveusergroups' ) ) {
 84+ $reason = $wgRequest->getVal( 'user-reason' );
 85+ $tok = $wgRequest->getVal( 'wpEditToken' );
 86+ if ( $wgUser->matchEditToken( $tok ) ) {
 87+ $allgroups = self::$grantableUserGroups;
 88+ $addgroup = array();
 89+ foreach ( $allgroups as $group ) {
 90+ // This batch form is only for adding user groups, we don't remove any.
 91+ if ( $wgRequest->getCheck( "wpGroup-$group" ) ) {
 92+ $addgroup[] = $group;
 93+ }
 94+ }
 95+
 96+ if ( count( $addgroup ) == 0 ) {
 97+ $wgOut->addHTML(
 98+ '<strong style="background-color:#faa">' .
 99+ wfMsg( 'batchuserrights-no-groups' ) .
 100+ "</strong><br /><br />\n"
 101+ );
 102+ } else {
 103+ global $wgLang;
 104+
 105+ $wgOut->addHTML( wfMsgExt(
 106+ 'batchuserrights-add-groups',
 107+ 'parseinline',
 108+ count( $usernames ),
 109+ count( $addgroup ),
 110+ $wgLang->listToText( $addgroup )
 111+ ) . "<br /><br />\n" );
 112+ }
 113+
 114+ // Loop through each target user and apply the update.
 115+ foreach ( $usernames as $username ) {
 116+ $username = trim( $username );
 117+ if( $username !== '' ) {
 118+ $wgOut->addHTML( wfMsgExt(
 119+ 'batchuserrights-single-progress-update',
 120+ 'parseinline',
 121+ count( $addgroup ),
 122+ $username
 123+ ) . "<br />\n" );
 124+ $this->saveUserGroups( $username, $addgroup, $reason );
 125+ }
 126+ }
 127+ }
 128+ }
 129+ }
 130+
 131+ // Show the list of avialable rights.
 132+ $this->showEditUserGroupsForm();
 133+ }
 134+
 135+ /**
 136+ * Save user groups changes in the database.
 137+ * Data comes from the showEditUserGroupsForm() form function
 138+ *
 139+ * @param $username String: username to apply changes to.
 140+ * @param $addgroup Array: group names which the user should be added to.
 141+ * @param $reason String: reason for group change
 142+ * @return null
 143+ */
 144+ function saveUserGroups( $username, $addgroup, $reason = '' ) {
 145+ global $wgRequest, $wgUser;
 146+
 147+ if ( $username == $wgUser->getName() ) {
 148+ $this->isself = true;
 149+ }
 150+
 151+ $user = $this->fetchUser( $username );
 152+ if ( !$user ) {
 153+ global $wgOut;
 154+
 155+ $wgOut->addHTML(
 156+ '<strong style="background-color:#faa">' .
 157+ wfMsgExt( 'batchuserrights-userload-error', 'parseinline', $username ) .
 158+ '</strong><br />'
 159+ );
 160+
 161+ return;
 162+ }
 163+
 164+ // Validate input set...
 165+ $changeable = $this->changeableGroups();
 166+ $addable = array_merge( $changeable['add'], $this->isself ? $changeable['add-self'] : array() );
 167+
 168+ $addgroup = array_unique(
 169+ array_intersect( (array)$addgroup, $addable )
 170+ );
 171+
 172+ $oldGroups = $user->getGroups();
 173+ $newGroups = $oldGroups;
 174+
 175+ if ( $addgroup ) {
 176+ $newGroups = array_merge( $newGroups, $addgroup );
 177+ foreach ( $addgroup as $group ) {
 178+ $user->addGroup( $group );
 179+ }
 180+ }
 181+ $newGroups = array_unique( $newGroups );
 182+
 183+ // Ensure that caches are cleared
 184+ $user->invalidateCache();
 185+
 186+ wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) );
 187+ wfDebug( 'newGroups: ' . print_r( $newGroups, true ) );
 188+ if ( $user instanceof User ) {
 189+ $removegroup = array();
 190+ // hmmm
 191+ wfRunHooks( 'UserRights', array( &$user, $addgroup, $removegroup ) );
 192+ }
 193+
 194+ if ( $newGroups != $oldGroups ) {
 195+ $this->addLogEntry( $user, $oldGroups, $newGroups );
 196+ }
 197+ }
 198+
 199+ /**
 200+ * Add a rights log entry for an action.
 201+ */
 202+ function addLogEntry( $user, $oldGroups, $newGroups ) {
 203+ global $wgRequest;
 204+ $log = new LogPage( 'rights' );
 205+
 206+ $log->addEntry( 'rights',
 207+ $user->getUserPage(),
 208+ $wgRequest->getText( 'user-reason' ),
 209+ array(
 210+ $this->makeGroupNameListForLog( $oldGroups ),
 211+ $this->makeGroupNameListForLog( $newGroups )
 212+ )
 213+ );
 214+ }
 215+
 216+ /**
 217+ * Normalize the input username, which may be local or remote, and
 218+ * return a user (or proxy) object for manipulating it.
 219+ *
 220+ * Side effects: error output for invalid access
 221+ * @return mixed User, UserRightsProxy, or null
 222+ */
 223+ function fetchUser( $username ) {
 224+ global $wgOut, $wgUser, $wgUserrightsInterwikiDelimiter;
 225+
 226+ $parts = explode( $wgUserrightsInterwikiDelimiter, $username );
 227+ if ( count( $parts ) < 2 ) {
 228+ $name = trim( $username );
 229+ $database = '';
 230+ } else {
 231+ list( $name, $database ) = array_map( 'trim', $parts );
 232+
 233+ if ( !$wgUser->isAllowed( 'userrights-interwiki' ) ) {
 234+ $wgOut->addWikiMsg( 'userrights-no-interwiki' );
 235+ return null;
 236+ }
 237+ if ( !UserRightsProxy::validDatabase( $database ) ) {
 238+ $wgOut->addWikiMsg( 'userrights-nodatabase', $database );
 239+ return null;
 240+ }
 241+ }
 242+
 243+ if ( $name == '' ) {
 244+ $wgOut->addWikiMsg( 'nouserspecified' );
 245+ return false;
 246+ }
 247+
 248+ if ( $name{0} == '#' ) {
 249+ // Numeric ID can be specified...
 250+ // We'll do a lookup for the name internally.
 251+ $id = intval( substr( $name, 1 ) );
 252+
 253+ if ( $database == '' ) {
 254+ $name = User::whoIs( $id );
 255+ } else {
 256+ $name = UserRightsProxy::whoIs( $database, $id );
 257+ }
 258+
 259+ if ( !$name ) {
 260+ $wgOut->addWikiMsg( 'noname' );
 261+ return null;
 262+ }
 263+ }
 264+
 265+ if ( $database == '' ) {
 266+ $user = User::newFromName( $name );
 267+ } else {
 268+ $user = UserRightsProxy::newFromName( $database, $name );
 269+ }
 270+
 271+ if ( !$user || $user->isAnon() ) {
 272+ $wgOut->addWikiMsg( 'nosuchusershort', $username );
 273+ return null;
 274+ }
 275+
 276+ return $user;
 277+ }
 278+
 279+ function makeGroupNameList( $ids ) {
 280+ if ( empty( $ids ) ) {
 281+ return wfMsgForContent( 'rightsnone' );
 282+ } else {
 283+ return implode( ', ', $ids );
 284+ }
 285+ }
 286+
 287+ function makeGroupNameListForLog( $ids ) {
 288+ if ( empty( $ids ) ) {
 289+ return '';
 290+ } else {
 291+ return $this->makeGroupNameList( $ids );
 292+ }
 293+ }
 294+
 295+ /**
 296+ * Go through used and available groups and return the ones that this
 297+ * form will be able to manipulate based on the current user's system
 298+ * permissions.
 299+ *
 300+ * @param $groups Array: list of groups the given user is in
 301+ * @return Array: Tuple of addable, then removable groups
 302+ */
 303+ protected function splitGroups( $groups ) {
 304+ list( $addable, $removable, $addself, $removeself ) = array_values( $this->changeableGroups() );
 305+
 306+ $removable = array_intersect(
 307+ array_merge( $this->isself ? $removeself : array(), $removable ),
 308+ $groups
 309+ ); // Can't remove groups the user doesn't have
 310+ $addable = array_diff(
 311+ array_merge( $this->isself ? $addself : array(), $addable ),
 312+ $groups
 313+ ); // Can't add groups the user does have
 314+
 315+ return array( $addable, $removable );
 316+ }
 317+
 318+ /**
 319+ * Show the form to add group memberships to one or more users at once.
 320+ */
 321+ protected function showEditUserGroupsForm() {
 322+ global $wgOut, $wgUser;
 323+
 324+ $wgOut->addHTML(
 325+ Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2' ) ) .
 326+ Html::hidden( 'wpEditToken', $wgUser->editToken() ) .
 327+ Xml::openElement( 'fieldset' ) .
 328+ Xml::element( 'legend', array(), wfMsg( 'userrights-editusergroup' ) ) .
 329+ wfMsgExt( 'batchuserrights-intro', array( 'parse' ) ) .
 330+ Xml::tags( 'p', null, $this->groupCheckboxes() ) .
 331+ Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-userrights-table-outer' ) ) .
 332+ '<tr>
 333+ <td class="mw-label">' .
 334+ Xml::label( wfMsg( 'batchuserrights-names' ), 'wpUsernames' ) .
 335+ '</td>
 336+ <td class="mw-input">' .
 337+ Xml::textarea( 'wpUsernames', '' ) .
 338+ '</td>
 339+ </tr>
 340+ <tr>
 341+ <td class="mw-label">' .
 342+ Xml::label( wfMsg( 'userrights-reason' ), 'wpReason' ) .
 343+ '</td>
 344+ <td class="mw-input">' .
 345+ Xml::input( 'user-reason', 60, false, array( 'id' => 'wpReason', 'maxlength' => 255 ) ) .
 346+ '</td>
 347+ </tr>
 348+ <tr>
 349+ <td></td>
 350+ <td class="mw-submit">' .
 351+ Xml::submitButton( wfMsg( 'saveusergroups' ), array( 'name' => 'saveusergroups', 'accesskey' => 's' ) ) .
 352+ '</td>
 353+ </tr>' .
 354+ Xml::closeElement( 'table' ) . "\n" .
 355+ Xml::closeElement( 'fieldset' ) .
 356+ Xml::closeElement( 'form' ) . "\n"
 357+ );
 358+ }
 359+
 360+ /**
 361+ * Adds a table with checkboxes where you can select what groups to add/remove
 362+ *
 363+ * @return string XHTML table element with checkboxes
 364+ */
 365+ private function groupCheckboxes() {
 366+ $usergroups = array(); // kinda a hack... this array holds "selected" groups... of which there shouldn't be any for this SpecialPage
 367+
 368+ $allgroups = self::$grantableUserGroups;
 369+ $ret = '';
 370+
 371+ $column = 1;
 372+ $settable_col = '';
 373+ $unsettable_col = '';
 374+
 375+ foreach ( $allgroups as $group ) {
 376+ $set = false;
 377+ # Should the checkbox be disabled?
 378+ $disabled = !( !$set && $this->canAdd( $group ) );
 379+ # Do we need to point out that this action is irreversible?
 380+ $irreversible = !$disabled && (
 381+ ( $set && !$this->canAdd( $group ) ) ||
 382+ ( !$set && !$this->canRemove( $group ) ) );
 383+
 384+ /* Wikia change begin - @author: Marooned */
 385+ /* Because of "return all" in changeableGroups() hook UserrightsChangeableGroups is not invoked - this hook is to fill this gap */
 386+ wfRunHooks( 'UserRights::groupCheckboxes', array( $group, &$disabled, &$irreversible ) );
 387+ /* Wikia change end */
 388+
 389+ $attr = $disabled ? array( 'disabled' => 'disabled' ) : array();
 390+ $attr['title'] = $group;
 391+ $text = $irreversible
 392+ ? wfMsgHtml( 'userrights-irreversible-marker', User::getGroupMember( $group ) )
 393+ : User::getGroupMember( $group );
 394+ $checkbox = Xml::checkLabel( $text, "wpGroup-$group",
 395+ "wpGroup-$group", $set, $attr );
 396+ $checkbox = $disabled ? Xml::tags( 'span', array( 'class' => 'mw-userrights-disabled' ), $checkbox ) : $checkbox;
 397+
 398+ if ( $disabled ) {
 399+ $unsettable_col .= "$checkbox<br />\n";
 400+ } else {
 401+ $settable_col .= "$checkbox<br />\n";
 402+ }
 403+ }
 404+
 405+ if ( $column ) {
 406+ $ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) .
 407+ '<tr>
 408+';
 409+ if ( $settable_col !== '' ) {
 410+ $ret .= Xml::element( 'th', null, wfMsg( 'userrights-changeable-col' ) );
 411+ }
 412+ if ( $unsettable_col !== '' ) {
 413+ $ret .= Xml::element( 'th', null, wfMsg( 'userrights-unchangeable-col' ) );
 414+ }
 415+ $ret .= '</tr>
 416+ <tr>
 417+';
 418+ if ( $settable_col !== '' ) {
 419+ $ret .=
 420+" <td style='vertical-align:top;'>
 421+ $settable_col
 422+ </td>
 423+";
 424+ }
 425+ if ( $unsettable_col !== '' ) {
 426+ $ret .=
 427+" <td style='vertical-align:top;'>
 428+ $unsettable_col
 429+ </td>
 430+";
 431+ }
 432+ $ret .= Xml::closeElement( 'tr' ) . Xml::closeElement( 'table' );
 433+ }
 434+
 435+ return $ret;
 436+ }
 437+
 438+ /**
 439+ * @param $group String: the name of the group to check
 440+ * @return bool Can we remove the group?
 441+ */
 442+ private function canRemove( $group ) {
 443+ // $this->changeableGroups()['remove'] doesn't work, of course. Thanks,
 444+ // PHP.
 445+ $groups = $this->changeableGroups();
 446+ return in_array( $group, $groups['remove'] ) || ( $this->isself && in_array( $group, $groups['remove-self'] ) );
 447+ }
 448+
 449+ /**
 450+ * @param $group string: the name of the group to check
 451+ * @return bool Can we add the group?
 452+ */
 453+ private function canAdd( $group ) {
 454+ $groups = $this->changeableGroups();
 455+ return in_array( $group, $groups['add'] ) || ( $this->isself && in_array( $group, $groups['add-self'] ) );
 456+ }
 457+
 458+ /**
 459+ * Returns an array of the groups that the user can add/remove.
 460+ *
 461+ * @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) , 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )
 462+ */
 463+ function changeableGroups() {
 464+ global $wgUser;
 465+
 466+ if ( $wgUser->isAllowed( 'userrights' ) ) {
 467+ // This group gives the right to modify everything (reverse-
 468+ // compatibility with old "userrights lets you change
 469+ // everything")
 470+ // Using array_merge to make the groups reindexed
 471+ $all = array_merge( User::getAllGroups() );
 472+ return array(
 473+ 'add' => $all,
 474+ 'remove' => $all,
 475+ 'add-self' => array(),
 476+ 'remove-self' => array()
 477+ );
 478+ }
 479+
 480+ // Okay, it's not so simple, we will have to go through the arrays
 481+ $groups = array(
 482+ 'add' => array(),
 483+ 'remove' => array(),
 484+ 'add-self' => array(),
 485+ 'remove-self' => array()
 486+ );
 487+ $addergroups = $wgUser->getEffectiveGroups();
 488+
 489+ foreach ( $addergroups as $addergroup ) {
 490+ $groups = array_merge_recursive(
 491+ $groups, $this->changeableByGroup( $addergroup )
 492+ );
 493+ $groups['add'] = array_unique( $groups['add'] );
 494+ $groups['remove'] = array_unique( $groups['remove'] );
 495+ $groups['add-self'] = array_unique( $groups['add-self'] );
 496+ $groups['remove-self'] = array_unique( $groups['remove-self'] );
 497+ }
 498+
 499+ // Run a hook because we can
 500+ wfRunHooks( 'UserrightsChangeableGroups', array( $this, $wgUser, $addergroups, &$groups ) );
 501+
 502+ return $groups;
 503+ }
 504+
 505+ /**
 506+ * Returns an array of the groups that a particular group can add/remove.
 507+ *
 508+ * @param $group String: the group to check for whether it can add/remove
 509+ * @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) , 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )
 510+ */
 511+ private function changeableByGroup( $group ) {
 512+ global $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
 513+
 514+ $groups = array(
 515+ 'add' => array(),
 516+ 'remove' => array(),
 517+ 'add-self' => array(),
 518+ 'remove-self' => array()
 519+ );
 520+ if ( empty( $wgAddGroups[$group] ) ) {
 521+ // Don't add anything to $groups
 522+ } elseif ( $wgAddGroups[$group] === true ) {
 523+ // You get everything
 524+ $groups['add'] = User::getAllGroups();
 525+ } elseif ( is_array( $wgAddGroups[$group] ) ) {
 526+ $groups['add'] = $wgAddGroups[$group];
 527+ }
 528+
 529+ // Same thing for remove
 530+ if ( empty( $wgRemoveGroups[$group] ) ) {
 531+ } elseif ( $wgRemoveGroups[$group] === true ) {
 532+ $groups['remove'] = User::getAllGroups();
 533+ } elseif ( is_array( $wgRemoveGroups[$group] ) ) {
 534+ $groups['remove'] = $wgRemoveGroups[$group];
 535+ }
 536+
 537+ // Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
 538+ if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
 539+ foreach ( $wgGroupsAddToSelf as $key => $value ) {
 540+ if ( is_int( $key ) ) {
 541+ $wgGroupsAddToSelf['user'][] = $value;
 542+ }
 543+ }
 544+ }
 545+
 546+ if ( empty( $wgGroupsRemoveFromSelf['user'] ) || $wgGroupsRemoveFromSelf['user'] !== true ) {
 547+ foreach ( $wgGroupsRemoveFromSelf as $key => $value ) {
 548+ if ( is_int( $key ) ) {
 549+ $wgGroupsRemoveFromSelf['user'][] = $value;
 550+ }
 551+ }
 552+ }
 553+
 554+ // Now figure out what groups the user can add to him/herself
 555+ if ( empty( $wgGroupsAddToSelf[$group] ) ) {
 556+ } elseif ( $wgGroupsAddToSelf[$group] === true ) {
 557+ // No idea WHY this would be used, but it's there
 558+ $groups['add-self'] = User::getAllGroups();
 559+ } elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
 560+ $groups['add-self'] = $wgGroupsAddToSelf[$group];
 561+ }
 562+
 563+ if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
 564+ } elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
 565+ $groups['remove-self'] = User::getAllGroups();
 566+ } elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
 567+ $groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
 568+ }
 569+
 570+ return $groups;
 571+ }
 572+}
\ No newline at end of file
Property changes on: trunk/extensions/BatchUserRights/SpecialBatchUserRights.php
___________________________________________________________________
Added: svn:eol-style
1573 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r104966complete message documentationcervidae13:37, 2 December 2011

Comments

#Comment by Siebrand (talk | contribs)   22:12, 20 October 2011

Please add message documentation for the newly added messages. Thanks.

#Comment by SVG (talk | contribs)   13:39, 2 December 2011

Done in r104966

Status & tagging log