r49411 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49410‎ | r49411 | r49412 >
Date:17:47, 11 April 2009
Author:btongminh
Status:deferred
Tags:
Comment:
creating a branch for my NssMySQLAuth rewrite
Modified paths:
  • /branches/NssMySQLAuth-rewrite/NssMySQLAuth (added) (history)

Diff [purge]

Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuth.i18n.php
@@ -0,0 +1,794 @@
 2+<?php
 3+/*
 4+ * Internationalization for NssMySQLAuth extension.
 5+ */
 6+
 7+$messages = array();
 8+
 9+/**
 10+ * English
 11+ * @author Bryan Tong Minh
 12+ */
 13+$messages['en'] = array(
 14+ 'accountmanager' => 'Account manager',
 15+
 16+ 'am-username' => 'username',
 17+ 'am-email' => 'e-mail',
 18+ 'am-active' => 'active',
 19+ 'am-updated' => 'Your changes have been saved successfully',
 20+
 21+ 'nss-desc' => 'A plugin to authenticate against a libnss-mysql database. Contains an [[Special:AccountManager|account manager]]',
 22+ 'nss-rights' => 'rights',
 23+ 'nss-save-changes' => 'Save changes',
 24+ 'nss-create-account-header' => 'Create new account',
 25+ 'nss-create-account' => 'Create account',
 26+ 'nss-no-mail' => 'Do not send email',
 27+ 'nss-welcome-mail' => 'An account with username $1 and password $2 has been created for you.',
 28+ 'nss-welcome-mail-subject' => 'Account creation',
 29+
 30+ 'nss-db-error' => 'Error reading from authentication database'
 31+);
 32+
 33+/** Message documentation (Message documentation)
 34+ * @author EugeneZelenko
 35+ * @author Purodha
 36+ */
 37+$messages['qqq'] = array(
 38+ 'am-username' => '{{Identical|Username}}',
 39+ 'am-email' => '{{Identical|E-mail}}',
 40+ 'nss-desc' => 'Short desciption of this extension.
 41+Shown in [[Special:Version]].
 42+Do not translate or change tag names, or link anchors.',
 43+);
 44+
 45+/** Arabic (العربية)
 46+ * @author Meno25
 47+ * @author OsamaK
 48+ */
 49+$messages['ar'] = array(
 50+ 'accountmanager' => 'مدير الحساب',
 51+ 'am-username' => 'اسم المستخدم',
 52+ 'am-email' => 'البريد الإلكتروني',
 53+ 'am-active' => 'نشط',
 54+ 'am-updated' => 'تغييراتك تم حفظها بنجاح',
 55+ 'nss-desc' => 'إضافة للتحقق ضد قاعدة بيانات libnss-mysql. يحتوي على [[Special:AccountManager|مدير حساب]]',
 56+ 'nss-rights' => 'صلاحيات',
 57+ 'nss-save-changes' => 'حفظ التغييرات',
 58+ 'nss-create-account-header' => 'إنشاء حساب جديد',
 59+ 'nss-create-account' => 'إنشاء الحساب',
 60+ 'nss-no-mail' => 'لا ترسل بريدا إلكترونيا',
 61+ 'nss-welcome-mail' => 'الحساب باسم المستخدم $1 وكلمة السر $2 تم إنشاؤه من أجلك.',
 62+ 'nss-welcome-mail-subject' => 'إنشاء الحساب',
 63+ 'nss-db-error' => 'خطأ قراءة من قاعدة بيانات التحقق.',
 64+);
 65+
 66+/** Egyptian Spoken Arabic (مصرى)
 67+ * @author Ghaly
 68+ * @author Meno25
 69+ * @author Ouda
 70+ */
 71+$messages['arz'] = array(
 72+ 'accountmanager' => 'مدير الحساب',
 73+ 'am-username' => 'اسم اليوزر',
 74+ 'am-email' => 'البريد الإلكترونى',
 75+ 'am-active' => 'نشط',
 76+ 'am-updated' => 'تغييراتك تم حفظها بنجاح',
 77+ 'nss-desc' => 'إضافة للتحقق ضد قاعدة بيانات libnss-mysql. يحتوى على [[Special:AccountManager|مدير حساب]]',
 78+ 'nss-rights' => 'صلاحيات',
 79+ 'nss-save-changes' => 'حفظ التغييرات',
 80+ 'nss-create-account-header' => 'إنشاء حساب جديد',
 81+ 'nss-create-account' => 'إنشاء الحساب',
 82+ 'nss-no-mail' => 'لا ترسل بريد إلكتروني',
 83+ 'nss-welcome-mail' => 'الحساب باسم اليوزر $1 وكلمة السر $2 تم إنشاؤه من أجلك.',
 84+ 'nss-welcome-mail-subject' => 'إنشاء الحساب',
 85+ 'nss-db-error' => 'خطأ قراءة من قاعدة بيانات التحقق.',
 86+);
 87+
 88+/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
 89+ * @author EugeneZelenko
 90+ * @author Jim-by
 91+ */
 92+$messages['be-tarask'] = array(
 93+ 'accountmanager' => 'Кіраваньне рахункамі',
 94+ 'am-username' => 'імя ўдзельніка',
 95+ 'am-email' => 'адрас электроннай пошты',
 96+ 'am-active' => 'актыўны',
 97+ 'am-updated' => 'Вашы зьмены былі пасьпяхова захаваны',
 98+ 'nss-desc' => 'Дапашненьне для аўтэнтыфікацыі ў базе зьвестак libnss-mysql. Утрымлівае [[Special:AccountManager|кіраваньне рахункамі]]',
 99+ 'nss-rights' => 'правы',
 100+ 'nss-save-changes' => 'Захаваць зьмены',
 101+ 'nss-create-account-header' => 'Стварыць новы рахунак',
 102+ 'nss-create-account' => 'Стварыць рахунак',
 103+ 'nss-no-mail' => 'Не дасылаць ліст па электроннай пошце',
 104+ 'nss-welcome-mail' => 'Для Вас быў створаны рахунак з імем $1 і паролем $2.',
 105+ 'nss-welcome-mail-subject' => 'Стварэньне рахунку',
 106+ 'nss-db-error' => 'Памылка чытаньня з базы зьвестак аўтэнтыфікацыі',
 107+);
 108+
 109+/** Bulgarian (Български)
 110+ * @author DCLXVI
 111+ */
 112+$messages['bg'] = array(
 113+ 'am-username' => 'потребителско име',
 114+ 'am-email' => 'е-поща',
 115+ 'am-updated' => 'Промените бяха съхранени успешно!',
 116+ 'nss-rights' => 'права',
 117+ 'nss-save-changes' => 'Съхраняване на промените',
 118+ 'nss-create-account-header' => 'Създаване на нова сметка',
 119+ 'nss-create-account' => 'Създаване на сметка',
 120+ 'nss-welcome-mail' => 'Беше ви създадена сметка с потребителско име $1 и парола $2.',
 121+);
 122+
 123+/** Bosnian (Bosanski)
 124+ * @author CERminator
 125+ */
 126+$messages['bs'] = array(
 127+ 'accountmanager' => 'Upravljanje računima',
 128+ 'am-username' => 'korisničko ime',
 129+ 'am-email' => 'e-mail',
 130+ 'am-active' => 'aktivan',
 131+ 'am-updated' => 'Vaše promjene su uspješno sačuvane',
 132+ 'nss-desc' => 'Dodatak za autentifikaciju protiv libnss-mysql baze podataka. Sadrži [[Special:AccountManager|upravljanje računima]]',
 133+ 'nss-rights' => 'prava',
 134+ 'nss-save-changes' => 'Spremi promjene',
 135+ 'nss-create-account-header' => 'Napravi novi račun',
 136+ 'nss-create-account' => 'Napravi račun',
 137+ 'nss-no-mail' => 'Ne šalji e-mail',
 138+ 'nss-welcome-mail' => 'Račun sa korisničkim imenom $1 i šifrom $2 je napravljen za Vas.',
 139+ 'nss-welcome-mail-subject' => 'Pravljenje računa',
 140+ 'nss-db-error' => 'Greška pri čitanju iz autentifikacijske baze podataka',
 141+);
 142+
 143+/** Czech (Česky)
 144+ * @author Matěj Grabovský
 145+ */
 146+$messages['cs'] = array(
 147+ 'accountmanager' => 'Správce účtů',
 148+ 'am-username' => 'uživatelské jméno',
 149+ 'am-email' => 'email',
 150+ 'am-active' => 'aktivní',
 151+ 'am-updated' => 'Vaše změny byly úspěšně uloženy',
 152+ 'nss-desc' => 'Zásuvný modul na ověřování vůči dtabázi libnss-mysql. Obsahuje [[Special:AccountManager|správce účtů]]',
 153+ 'nss-rights' => 'práva',
 154+ 'nss-save-changes' => 'Uložit změny',
 155+ 'nss-create-account-header' => 'Vytvořit nový účet',
 156+ 'nss-create-account' => 'Vytvořit účet',
 157+ 'nss-no-mail' => 'Neposílat email',
 158+ 'nss-welcome-mail' => 'Byl pro vás vytvořen účet s uživatelským jménem $1 a heslem $2.',
 159+ 'nss-welcome-mail-subject' => 'Vytvoření účtu',
 160+ 'nss-db-error' => 'Chyba při čtení z ověřovací databáze',
 161+);
 162+
 163+/** German (Deutsch) */
 164+$messages['de'] = array(
 165+ 'accountmanager' => 'Benutzerkonten-Verwaltung',
 166+ 'am-username' => 'Benutzername',
 167+ 'am-email' => 'E-Mail',
 168+ 'am-active' => 'aktiv',
 169+ 'am-updated' => 'Die Änderungen wurden erfolgreich gespeichert',
 170+ 'nss-desc' => 'Eine Erweiterung, um gegen eine libnss-mysql-Datenbank zu authentifizieren. Inklusive einer [[Special:AccountManager|Benutzerkonten-Verwaltung]]',
 171+ 'nss-rights' => 'Rechte',
 172+ 'nss-save-changes' => 'Änderungen speichern',
 173+ 'nss-create-account-header' => 'Neues Benutzerkonto erstellen',
 174+ 'nss-create-account' => 'Benutzerkonto erstellen',
 175+ 'nss-no-mail' => 'Sende keine E-Mail',
 176+ 'nss-welcome-mail' => 'Ein Benutzerkonto mit dem Benutzernamen „$1“ und dem Passwort „$2“ wurde für dich erstellt.',
 177+ 'nss-welcome-mail-subject' => 'Benutzerkonto erstellen',
 178+ 'nss-db-error' => 'Fehler beim Lesen aus der Authentifizierungs-Datenbank',
 179+);
 180+
 181+/** Lower Sorbian (Dolnoserbski)
 182+ * @author Michawiki
 183+ */
 184+$messages['dsb'] = array(
 185+ 'accountmanager' => 'Zastojnik kontow',
 186+ 'am-username' => 'wužywarske mě',
 187+ 'am-email' => 'e-mail',
 188+ 'am-active' => 'aktiwny',
 189+ 'am-updated' => 'Twóje změny su se wuspěšnje składowali.',
 190+ 'nss-desc' => 'Tykac, aby awtentificěrowało pśeśiwo datowej bance libnss-mysql. Wopśimujo [[Special:AccountManager|zastojnik kontow]]',
 191+ 'nss-rights' => 'pšawa',
 192+ 'nss-save-changes' => 'Změny składowaś',
 193+ 'nss-create-account-header' => 'Nowe konto załožyś',
 194+ 'nss-create-account' => 'Konto załožyś',
 195+ 'nss-no-mail' => 'Njepósćel e-mailku',
 196+ 'nss-welcome-mail' => 'Konto z wužywarskim mjenim $1 a gronidłom $2 jo se załožyło za tebje.',
 197+ 'nss-welcome-mail-subject' => 'Konto załožyś',
 198+ 'nss-db-error' => 'Zmólka pśi cytanju z awtenficěrowańskeje datoweje banki',
 199+);
 200+
 201+/** Esperanto (Esperanto)
 202+ * @author Yekrats
 203+ */
 204+$messages['eo'] = array(
 205+ 'accountmanager' => 'Konta administrilo',
 206+ 'am-username' => 'salutnomo',
 207+ 'am-email' => 'retpoŝto',
 208+ 'am-active' => 'aktiva',
 209+ 'am-updated' => 'Viaj ŝanĝoj estis sukcese ŝanĝitaj.',
 210+ 'nss-rights' => 'rajtoj',
 211+ 'nss-save-changes' => 'Konservi ŝanĝojn',
 212+ 'nss-create-account-header' => 'Krei novan konton',
 213+ 'nss-create-account' => 'Krei konton',
 214+ 'nss-no-mail' => 'Ne sendi retpoŝton',
 215+ 'nss-welcome-mail' => 'Konto kun salutnomo $1 kaj pasvorto $2 estis kreita por vi.',
 216+ 'nss-welcome-mail-subject' => 'Konta kreado',
 217+ 'nss-db-error' => 'Eraro legante de aŭtentokontrola datumbazo',
 218+);
 219+
 220+/** Spanish (Español)
 221+ * @author Crazymadlover
 222+ * @author Imre
 223+ */
 224+$messages['es'] = array(
 225+ 'accountmanager' => 'Administrador de cuenta',
 226+ 'am-username' => 'nombre de usuario',
 227+ 'am-email' => 'correo electrónico',
 228+ 'am-active' => 'activo',
 229+ 'am-updated' => 'Tus cambios han sido grabados exitosamente',
 230+ 'nss-desc' => 'Un plugin para autenticar contra una base de datos mysql-libnss. Contiene un [[Special:AccountManager|administrador de cuentas]]',
 231+ 'nss-rights' => 'derechos',
 232+ 'nss-save-changes' => 'Grabar cambios',
 233+ 'nss-create-account-header' => 'Crear nueva cuenta',
 234+ 'nss-create-account' => 'Crear cuenta',
 235+ 'nss-no-mail' => 'No enviar correo electrónico',
 236+ 'nss-welcome-mail' => 'Una cuenta con nombre de usuario $1 y contraseña $2 ha sido creado para ti.',
 237+ 'nss-welcome-mail-subject' => 'Creación de cuenta',
 238+ 'nss-db-error' => 'Error leyendo de la base de datos de autenticación',
 239+);
 240+
 241+/** Basque (Euskara)
 242+ * @author Kobazulo
 243+ */
 244+$messages['eu'] = array(
 245+ 'am-username' => 'lankide izena',
 246+ 'am-email' => 'e-posta',
 247+ 'am-updated' => 'Zure aldaketak ondo gorde dira',
 248+ 'nss-rights' => 'eskubideak',
 249+ 'nss-save-changes' => 'Aldaketak gorde',
 250+ 'nss-create-account-header' => 'Kontu berria sortu',
 251+ 'nss-create-account' => 'Kontua sortu',
 252+ 'nss-welcome-mail-subject' => 'Kontuen sorrera',
 253+);
 254+
 255+/** Finnish (Suomi)
 256+ * @author Str4nd
 257+ */
 258+$messages['fi'] = array(
 259+ 'am-username' => 'käyttäjätunnus',
 260+ 'am-email' => 'sähköposti',
 261+ 'am-updated' => 'Muutokset tallennettiin onnistuneesti',
 262+ 'nss-save-changes' => 'Tallenna muutokset',
 263+ 'nss-create-account-header' => 'Luo uusi tunnus',
 264+ 'nss-create-account' => 'Luo tunnus',
 265+ 'nss-no-mail' => 'Älä lähetä sähköpostia',
 266+ 'nss-welcome-mail-subject' => 'Tunnuksen luonti',
 267+);
 268+
 269+/** French (Français)
 270+ * @author Grondin
 271+ * @author IAlex
 272+ */
 273+$messages['fr'] = array(
 274+ 'accountmanager' => 'Gestionnaire de comptes',
 275+ 'am-username' => "Nom d'utilisateur",
 276+ 'am-email' => 'Courriel',
 277+ 'am-active' => 'actif',
 278+ 'am-updated' => 'Vos modifications ont été sauvegardées avec succès',
 279+ 'nss-desc' => "Une extension qui permet d'authentifier au moyen d'une base de données libnss-mysql. Contient un [[Special:AccountManager|gestionnaire de comptes]]",
 280+ 'nss-rights' => 'droits',
 281+ 'nss-save-changes' => 'Sauvegarder les modifications',
 282+ 'nss-create-account-header' => 'Créer un nouveau compte',
 283+ 'nss-create-account' => 'Créer le compte',
 284+ 'nss-no-mail' => 'Ne pas envoyer de courriel',
 285+ 'nss-welcome-mail' => 'Un compte avec le nom $1 et le mot de passe $2 a été créé pour vous.',
 286+ 'nss-welcome-mail-subject' => 'Création de compte',
 287+ 'nss-db-error' => "Erreur pendant la lecture de la base de données d'authentification",
 288+);
 289+
 290+/** Irish (Gaeilge)
 291+ * @author Alison
 292+ */
 293+$messages['ga'] = array(
 294+ 'am-username' => 'ainm úsáideoir',
 295+ 'am-email' => 'ríomhphost',
 296+ 'nss-rights' => 'cearta',
 297+);
 298+
 299+/** Galician (Galego)
 300+ * @author Toliño
 301+ */
 302+$messages['gl'] = array(
 303+ 'accountmanager' => 'Xestor de contas',
 304+ 'am-username' => 'nome de usuario',
 305+ 'am-email' => 'correo electrónico',
 306+ 'am-active' => 'activar',
 307+ 'am-updated' => 'Os seus cambios foron gardados con éxito',
 308+ 'nss-desc' => 'Un complemento para autenticar contra a base de datos libnss-mysql. Contén un [[Special:AccountManager|xestor de contas]]',
 309+ 'nss-rights' => 'dereitos',
 310+ 'nss-save-changes' => 'Gardar os cambios',
 311+ 'nss-create-account-header' => 'Crear unha conta nova',
 312+ 'nss-create-account' => 'Crear a conta',
 313+ 'nss-no-mail' => 'Non enviar o correo electrónico',
 314+ 'nss-welcome-mail' => 'Unha conta co nome de usuario "$1" e contrasinal "$2" foi creada para vostede.',
 315+ 'nss-welcome-mail-subject' => 'Creación de contas',
 316+ 'nss-db-error' => 'Erro ao ler a base de datos de autenticación',
 317+);
 318+
 319+/** Ancient Greek (Ἀρχαία ἑλληνικὴ)
 320+ * @author Crazymadlover
 321+ */
 322+$messages['grc'] = array(
 323+ 'am-username' => 'Ὄνομα χρωμένου',
 324+ 'am-email' => 'Ἠλεκτρονικαὶ ἐπιστολαί',
 325+);
 326+
 327+/** Swiss German (Alemannisch)
 328+ * @author Als-Holder
 329+ */
 330+$messages['gsw'] = array(
 331+ 'accountmanager' => 'Benutzerkonte-Verwaltig',
 332+ 'am-username' => 'Benutzername',
 333+ 'am-email' => 'E-Mail',
 334+ 'am-active' => 'aktiv',
 335+ 'am-updated' => 'Dyyni Änderige sin erfolgrych gspycheret wore',
 336+ 'nss-desc' => 'E Erwyterig zum authentifiziere iber e libnss-mysql-Datebank. S het au ne [[Special:AccountManager|Benutzerkonte-Verwaltig]] din',
 337+ 'nss-rights' => 'Rächt',
 338+ 'nss-save-changes' => 'Änderige spychere',
 339+ 'nss-create-account-header' => 'Nej Benutzerkonto aalege',
 340+ 'nss-create-account' => 'Benutzerkonto aalege',
 341+ 'nss-no-mail' => 'Kei E-Mail schicke',
 342+ 'nss-welcome-mail' => 'E Benutzerkonto mit em Benutzername „$1“ un em Passwort „$2“ isch fir Di aagleit wore.',
 343+ 'nss-welcome-mail-subject' => 'Benutzerkonto aalege',
 344+ 'nss-db-error' => 'Fähler bim Läsen us dr Authentifizierigs-Datebank',
 345+);
 346+
 347+/** Hebrew (עברית)
 348+ * @author Rotemliss
 349+ * @author YaronSh
 350+ */
 351+$messages['he'] = array(
 352+ 'accountmanager' => 'מנהל החשבונות',
 353+ 'am-username' => 'שם משתמש',
 354+ 'am-email' => 'דוא"ל',
 355+ 'am-active' => 'פעיל',
 356+ 'am-updated' => 'השינויים שלכם נשמרו בהצלחה',
 357+ 'nss-desc' => 'תוסף להזדהות מול מסד נתונים מסוג libnss-mysql. כולל [[Special:AccountManager|מנהל חשבונות]]',
 358+ 'nss-rights' => 'הרשאות',
 359+ 'nss-save-changes' => 'שמירת השינויים',
 360+ 'nss-create-account-header' => 'יצירת חשבון חדש',
 361+ 'nss-create-account' => 'יצירת חשבון',
 362+ 'nss-no-mail' => 'ללא שליחת דוא"ל',
 363+ 'nss-welcome-mail' => 'נוצר עבורכם חשבון משתמש עם שם המשתמש $1 והסיסמה $2.',
 364+ 'nss-welcome-mail-subject' => 'יצירת חשבון',
 365+ 'nss-db-error' => 'שגיאה בקריאה מבסיס הנתונים של ההזדהות',
 366+);
 367+
 368+/** Upper Sorbian (Hornjoserbsce)
 369+ * @author Michawiki
 370+ */
 371+$messages['hsb'] = array(
 372+ 'accountmanager' => 'Zrjadowak kontow',
 373+ 'am-username' => 'wužiwarske mjeno',
 374+ 'am-email' => 'e-mejl',
 375+ 'am-active' => 'aktiwny',
 376+ 'am-updated' => 'Twoje změny su so wuspěšnje składowali',
 377+ 'nss-desc' => 'Tykač, zo by přećiwo datowej bance libnss-mysql awtentifikowało. Wobsahuje [[Special:AccountManager|zrjadowak kontow]]',
 378+ 'nss-rights' => 'prawa',
 379+ 'nss-save-changes' => 'Změny składować',
 380+ 'nss-create-account-header' => 'Nowe konto załožić',
 381+ 'nss-create-account' => 'Konto załožić',
 382+ 'nss-no-mail' => 'Njepósćel e-mejlku',
 383+ 'nss-welcome-mail' => 'Konto z wužiwarskim mjenom $1 a hesłom $2 je so za tebje załožiło.',
 384+ 'nss-welcome-mail-subject' => 'Konto załožić',
 385+ 'nss-db-error' => 'Zmylk při čitanju z awtentifikaciskeje datoweje banki',
 386+);
 387+
 388+/** Interlingua (Interlingua)
 389+ * @author McDutchie
 390+ */
 391+$messages['ia'] = array(
 392+ 'accountmanager' => 'Gestion de contos',
 393+ 'am-username' => 'nomine de usator',
 394+ 'am-email' => 'e-mail',
 395+ 'am-active' => 'active',
 396+ 'am-updated' => 'Tu modificationes ha essite confirmate con successo',
 397+ 'nss-desc' => 'Un extension pro authenticar contra un base de datos libnss-mysql. Contine un programma pro le [[Special:AccountManager|gestion de contos]]',
 398+ 'nss-rights' => 'derectos',
 399+ 'nss-save-changes' => 'Confirmar modificationes',
 400+ 'nss-create-account-header' => 'Crear nove conto',
 401+ 'nss-create-account' => 'Crear conto',
 402+ 'nss-no-mail' => 'Non inviar e-mail',
 403+ 'nss-welcome-mail' => 'Un conto con le nomine de usator $1 e contrasigno $2 ha essite create pro te.',
 404+ 'nss-welcome-mail-subject' => 'Creation de contos',
 405+ 'nss-db-error' => 'Error durante le lection del base de datos de authentication',
 406+);
 407+
 408+/** Japanese (日本語)
 409+ * @author Fryed-peach
 410+ * @author Hosiryuhosi
 411+ * @author Mizusumashi
 412+ */
 413+$messages['ja'] = array(
 414+ 'accountmanager' => 'アカウントマネージャー',
 415+ 'am-username' => 'ユーザー名',
 416+ 'am-email' => '電子メール',
 417+ 'am-active' => '有効',
 418+ 'am-updated' => 'あなたの変更の保存が成功しました',
 419+ 'nss-desc' => 'libnss-mysqlデータベースに対して認証を行うプラグイン。[[Special:AccountManager|アカウント・マネージャー]]を含む。',
 420+ 'nss-rights' => '権限',
 421+ 'nss-save-changes' => '変更を保存',
 422+ 'nss-create-account-header' => '新しいアカウントを作成',
 423+ 'nss-create-account' => 'アカウントの作成',
 424+ 'nss-no-mail' => 'eメールを送らない',
 425+ 'nss-welcome-mail' => '利用者名 $1、パスワード $2 のアカウントが、あなた用に作成されました。',
 426+ 'nss-welcome-mail-subject' => 'アカウント作成',
 427+ 'nss-db-error' => '認証データベースからの読み込みエラー',
 428+);
 429+
 430+/** Khmer (ភាសាខ្មែរ)
 431+ * @author Thearith
 432+ */
 433+$messages['km'] = array(
 434+ 'accountmanager' => 'អ្នកគ្រប់គ្រង​គណនី',
 435+ 'am-username' => 'ឈ្មោះអ្នកប្រើប្រាស់',
 436+ 'am-email' => 'អ៊ីមែល',
 437+ 'am-active' => 'សកម្ម',
 438+ 'am-updated' => 'បំលាស់ប្ដូរ​របស់​អ្នក ត្រូវ​បាន​រក្សាទុក​ដោយ​ជោគជ័យ​ហើយ',
 439+ 'nss-rights' => 'សិទ្ធិ',
 440+ 'nss-save-changes' => 'រក្សាទុក​បំលាស់ប្ដូរ',
 441+ 'nss-create-account-header' => 'បង្កើត​គណនី​ថ្មី',
 442+ 'nss-create-account' => 'បង្កើត​គណនី',
 443+ 'nss-no-mail' => 'មិន​ផ្ញើ​អ៊ីមែល',
 444+ 'nss-welcome-mail-subject' => 'ការបង្កើត​គណនី',
 445+);
 446+
 447+/** Kinaray-a (Kinaray-a)
 448+ * @author Joebertj
 449+ */
 450+$messages['krj'] = array(
 451+ 'accountmanager' => 'Gadumala sa Account',
 452+ 'am-username' => 'username',
 453+ 'am-email' => 'e-mail',
 454+ 'am-active' => 'aktibo',
 455+ 'am-updated' => 'Ang imo mga gin-ilis nabaton run',
 456+);
 457+
 458+/** Ripoarisch (Ripoarisch)
 459+ * @author Purodha
 460+ */
 461+$messages['ksh'] = array(
 462+ 'accountmanager' => 'Metmaacher ier Aanmeldunge verwallde',
 463+ 'am-username' => 'Metmaachername',
 464+ 'am-email' => '<i lang="en">e-mail</i>',
 465+ 'am-active' => 'ne Aktive',
 466+ 'am-updated' => 'De Änderunge sen avjespeichert',
 467+ 'nss-desc' => 'Ene Zosatz, öm Metmaacher ier Annmeldunge övver en <i lang="en"><code>libnss-mysql</code></i> Datebangk pröve ze lohße. Met enem [[Special:AccountManager|Söndersigg för de Metmaacher ier Aanmeldunge zu verwallde]] dobei.',
 468+ 'nss-rights' => 'Rääschte',
 469+ 'nss-save-changes' => 'Änderunge avspeichere',
 470+ 'nss-create-account-header' => 'Ene neue Metmaacher aanlääje',
 471+ 'nss-create-account' => 'Aanlääje',
 472+ 'nss-no-mail' => 'Kein <i lang="en">e-mail</i> schecke',
 473+ 'nss-welcome-mail' => 'Ene Metmmacher met däm Name „$1“ un dämm Paßwoot „$2“ es för Desch opjesatz woode.',
 474+ 'nss-welcome-mail-subject' => 'Metmaacher neu aanmellde.',
 475+ 'nss-db-error' => 'Fähler beim Lesse uß dä Datebangk met dä Zohjangßdaate',
 476+);
 477+
 478+/** Luxembourgish (Lëtzebuergesch)
 479+ * @author Robby
 480+ */
 481+$messages['lb'] = array(
 482+ 'accountmanager' => 'Gestionnaire vun de Benotzerkonten',
 483+ 'am-username' => 'Benotzernumm',
 484+ 'am-email' => 'E-Mail',
 485+ 'am-active' => 'aktiv',
 486+ 'am-updated' => 'är Ännerunge goufe gespäichert',
 487+ 'nss-desc' => "E Plugin fir sech an enger ''libnss-mysql'' anzeloggen, inlusiv engem [[Special:AccountManager|Gestionnaire vun de Benotzerkonten]]",
 488+ 'nss-rights' => 'Rechter',
 489+ 'nss-save-changes' => 'Ännerunge späicheren',
 490+ 'nss-create-account-header' => 'Een neie Benotzerkont opmaachen',
 491+ 'nss-create-account' => 'Benotzerkont opmaachen',
 492+ 'nss-no-mail' => 'Keng E-Mail schécken',
 493+ 'nss-welcome-mail' => 'E Benotzerkont mat dem Benotzernumm $1 an dem Passwuert $2 gouf fir Iech opgemaach.',
 494+ 'nss-welcome-mail-subject' => 'Benotzerkont opmaachen',
 495+ 'nss-db-error' => 'Feeler beim Liese vun der Datebank mat den Authentifikatiounen',
 496+);
 497+
 498+/** Nahuatl (Nāhuatl)
 499+ * @author Fluence
 500+ */
 501+$messages['nah'] = array(
 502+ 'am-email' => 'e-mail',
 503+ 'nss-create-account-header' => 'Ticchīhuāz yancuīc cuentah',
 504+ 'nss-create-account' => 'Ticchīhuāz cuentah',
 505+);
 506+
 507+/** Dutch (Nederlands)
 508+ * @author Siebrand
 509+ */
 510+$messages['nl'] = array(
 511+ 'accountmanager' => 'Gebruikersbeheer',
 512+ 'am-username' => 'gebruikersnaam',
 513+ 'am-email' => 'e-mail',
 514+ 'am-active' => 'actief',
 515+ 'am-updated' => 'Uw wijzigingen zijn opgeslagen',
 516+ 'nss-desc' => 'Een plug-in om te authenticeren tegen een libnss-mysql database. Bevat [[Special:AccountManager|gebruikersbeheer]]',
 517+ 'nss-rights' => 'rechten',
 518+ 'nss-save-changes' => 'Wijzigingen opslaan',
 519+ 'nss-create-account-header' => 'Nieuwe gebruiker aanmaken',
 520+ 'nss-create-account' => 'Gebruiker aanmaken',
 521+ 'nss-no-mail' => 'Geen e-mail versturen',
 522+ 'nss-welcome-mail' => 'Er is een gebruiker met gebruikersnaam $1 en wachtwoord $2 voor u aangemaakt.',
 523+ 'nss-welcome-mail-subject' => 'Gebruiker aangemaakt',
 524+ 'nss-db-error' => 'Fout bij het lezen van de authenticatiedatabase',
 525+);
 526+
 527+/** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
 528+ * @author Harald Khan
 529+ */
 530+$messages['nn'] = array(
 531+ 'accountmanager' => 'Kontohandsamar',
 532+ 'am-username' => 'brukarnamn',
 533+ 'am-email' => 'e-post',
 534+ 'am-active' => 'aktiv',
 535+ 'am-updated' => 'Endringane dine vart lagra',
 536+ 'nss-desc' => 'Eit programtillegg for å identifisera mot ein libnss-mysql-database. Innheheld ein [[Special:AccountManager|kontohandsamar]]',
 537+ 'nss-rights' => 'rettar',
 538+ 'nss-save-changes' => 'Lagra endringar',
 539+ 'nss-create-account-header' => 'Opprett ny konto',
 540+ 'nss-create-account' => 'Opprett konto',
 541+ 'nss-no-mail' => 'Ikkje send e-post',
 542+ 'nss-welcome-mail' => 'Ein konto med brukarnamnet $1 og passordet $2 har vorten oppretta for deg.',
 543+ 'nss-welcome-mail-subject' => 'Kontooppretting',
 544+ 'nss-db-error' => 'Feil oppstod under lesing av identifiseringsdatabasen',
 545+);
 546+
 547+/** Occitan (Occitan)
 548+ * @author Cedric31
 549+ */
 550+$messages['oc'] = array(
 551+ 'accountmanager' => 'Gestionari de comptes',
 552+ 'am-username' => "Nom d'utilizaire",
 553+ 'am-email' => 'Corrièr electronic',
 554+ 'am-active' => 'actiu',
 555+ 'am-updated' => 'Vòstras modificacions son estadas salvadas amb succès',
 556+ 'nss-desc' => "Una extension que permet d'autentificar gràcias a una banca de donadas libnss-mysql. Conten un [[Special:AccountManager|gestionari de comptes]]",
 557+ 'nss-rights' => 'dreches',
 558+ 'nss-save-changes' => 'Enregistrar los cambiaments',
 559+ 'nss-create-account-header' => 'Crear un compte novèl',
 560+ 'nss-create-account' => 'Crear un compte',
 561+ 'nss-no-mail' => 'Mandar pas de corrièr electronic',
 562+ 'nss-welcome-mail' => 'Un compte amb lo nom $1 e lo senhal $2 es estat creat per vos.',
 563+ 'nss-welcome-mail-subject' => 'Creacion de compte',
 564+ 'nss-db-error' => "Error pendent la lectura de la banca de donadas d'autentificacion",
 565+);
 566+
 567+/** Polish (Polski)
 568+ * @author Derbeth
 569+ * @author Leinad
 570+ * @author Sp5uhe
 571+ */
 572+$messages['pl'] = array(
 573+ 'accountmanager' => 'Menedżer konta',
 574+ 'am-username' => 'nazwa użytkownika',
 575+ 'am-email' => 'e‐mail',
 576+ 'am-active' => 'aktywny',
 577+ 'am-updated' => 'Wprowadzone zmiany zostały zapisane pomyślnie',
 578+ 'nss-desc' => 'Wtyczka do uwierzytelniania w bazie danych libnss-mysql. Zawiera [[Special:AccountManager|menedżer konta]]',
 579+ 'nss-rights' => 'uprawnienia',
 580+ 'nss-save-changes' => 'Zapisz zmiany',
 581+ 'nss-create-account-header' => 'Utwórz nowe konto',
 582+ 'nss-create-account' => 'Utwórz konto',
 583+ 'nss-no-mail' => 'Nie wysyłaj e‐maila',
 584+ 'nss-welcome-mail' => 'Zostało dla Ciebie utworzone konto z nazwą użytkownika $1 i hasłem $2.',
 585+ 'nss-welcome-mail-subject' => 'Utworzenie konta',
 586+ 'nss-db-error' => 'Błąd odczytu z uwierzytelniania bazy danych',
 587+);
 588+
 589+/** Portuguese (Português)
 590+ * @author Malafaya
 591+ * @author Waldir
 592+ */
 593+$messages['pt'] = array(
 594+ 'accountmanager' => 'Gestor de contas',
 595+ 'am-username' => 'nome de utilizador',
 596+ 'am-email' => 'e-mail',
 597+ 'am-active' => 'activo',
 598+ 'am-updated' => 'As suas alterações foram gravadas com sucesso',
 599+ 'nss-desc' => 'Um "plugin" para autenticar numa base de dados libnss-mysql. Contém um [[Special:AccountManager|gestor de contas]]',
 600+ 'nss-rights' => 'permissões',
 601+ 'nss-save-changes' => 'Gravar alterações',
 602+ 'nss-create-account-header' => 'Criar nova conta',
 603+ 'nss-create-account' => 'Criar conta',
 604+ 'nss-no-mail' => 'Não enviar email',
 605+ 'nss-welcome-mail' => 'Uma conta com nome de utilizador $1 e palavra-chave $2 foi criada para si.',
 606+ 'nss-welcome-mail-subject' => 'Criação de conta',
 607+ 'nss-db-error' => 'Erro na leitura da base de dados de autenticação',
 608+);
 609+
 610+/** Brazilian Portuguese (Português do Brasil)
 611+ * @author Eduardo.mps
 612+ */
 613+$messages['pt-br'] = array(
 614+ 'accountmanager' => 'Gerenciador de contas',
 615+ 'am-username' => 'nome de utilizador',
 616+ 'am-email' => 'e-mail',
 617+ 'am-active' => 'ativo',
 618+ 'am-updated' => 'As suas alterações foram gravadas com sucesso',
 619+ 'nss-desc' => 'Um "plugin" para autenticar numa base de dados libnss-mysql. Contém um [[Special:AccountManager|gerenciador de contas]]',
 620+ 'nss-rights' => 'permissões',
 621+ 'nss-save-changes' => 'Gravar alterações',
 622+ 'nss-create-account-header' => 'Criar nova conta',
 623+ 'nss-create-account' => 'Criar conta',
 624+ 'nss-no-mail' => 'Não enviar email',
 625+ 'nss-welcome-mail' => 'Uma conta com nome de utilizador $1 e palavra-chave $2 foi criada para você.',
 626+ 'nss-welcome-mail-subject' => 'Criação de conta',
 627+ 'nss-db-error' => 'Erro na leitura da base de dados de autenticação',
 628+);
 629+
 630+/** Romanian (Română)
 631+ * @author KlaudiuMihaila
 632+ * @author Silviubogan
 633+ */
 634+$messages['ro'] = array(
 635+ 'am-username' => 'nume de utilizator',
 636+ 'am-email' => 'e-mail',
 637+ 'am-active' => 'activ',
 638+ 'nss-save-changes' => 'Salvează modificările',
 639+ 'nss-create-account-header' => 'Creează cont nou',
 640+ 'nss-create-account' => 'Creează cont',
 641+ 'nss-welcome-mail-subject' => 'Crearea contului',
 642+);
 643+
 644+/** Tarandíne (Tarandíne)
 645+ * @author Joetaras
 646+ */
 647+$messages['roa-tara'] = array(
 648+ 'accountmanager' => 'Gestore de le cunde utinde',
 649+ 'am-username' => "nome de l'utende",
 650+ 'am-email' => 'e-mail',
 651+ 'am-active' => 'attive',
 652+ 'am-updated' => 'Le cangiaminde tue onne state reggistrate correttamende',
 653+ 'nss-desc' => "'Nu plugin pe autendicà condre a 'nu database libnss-mysql. Condene 'nu [[Special:AccountManager|gestore de cunde utinde]]",
 654+ 'nss-rights' => 'deritte',
 655+ 'nss-save-changes' => 'Reggistre le cangiaminde',
 656+ 'nss-create-account-header' => "Ccreje 'nu cunde utende nuève",
 657+ 'nss-create-account' => "Ccreje 'nu cunde utende",
 658+ 'nss-no-mail' => 'No sce invianne le email',
 659+ 'nss-welcome-mail' => "'Nu cunde utende cu 'u nome $1 e 'a password $2 ha state ccrejate pe te.",
 660+ 'nss-welcome-mail-subject' => "Creazione d'u cunde utende",
 661+ 'nss-db-error' => "Errore leggenne da l'autendicazione d'u database",
 662+);
 663+
 664+/** Russian (Русский)
 665+ * @author Ferrer
 666+ * @author Александр Сигачёв
 667+ */
 668+$messages['ru'] = array(
 669+ 'accountmanager' => 'Управление учётными записями',
 670+ 'am-username' => 'имя участника',
 671+ 'am-email' => 'электронная почта',
 672+ 'nss-rights' => 'права',
 673+ 'nss-save-changes' => 'Сохранить изменения',
 674+ 'nss-create-account-header' => 'Создать новую учётную запись',
 675+ 'nss-create-account' => 'Создание учётной записи',
 676+ 'nss-welcome-mail' => 'Для вас создана учётная запись с именем $1 и паролем $2.',
 677+ 'nss-welcome-mail-subject' => 'Создание учётной записи',
 678+);
 679+
 680+/** Slovak (Slovenčina)
 681+ * @author Helix84
 682+ */
 683+$messages['sk'] = array(
 684+ 'accountmanager' => 'Správca účtov',
 685+ 'am-username' => 'používateľské meno',
 686+ 'am-email' => 'email',
 687+ 'am-active' => 'aktívny',
 688+ 'am-updated' => 'Vaše zmeny boli úspešne uložené',
 689+ 'nss-desc' => 'Zásuvný modul na overovanie voči databáze libnss-mysql. Obsahuje [[Special:AccountManager|správcu účtov]].',
 690+ 'nss-rights' => 'práva',
 691+ 'nss-save-changes' => 'Uložiť zmeny',
 692+ 'nss-create-account-header' => 'Vytvoriť nový účet',
 693+ 'nss-create-account' => 'Vytvoriť účet',
 694+ 'nss-no-mail' => 'Neposielať email',
 695+ 'nss-welcome-mail' => 'Bol pre vás vytvorený účet s používateľským menom $1 a heslom $2.',
 696+ 'nss-welcome-mail-subject' => 'Vytvorenie účtu',
 697+ 'nss-db-error' => 'Chyba pri čítaní z overovacej databázy',
 698+);
 699+
 700+/** Swedish (Svenska)
 701+ * @author Najami
 702+ */
 703+$messages['sv'] = array(
 704+ 'am-username' => 'användarnamn',
 705+ 'am-email' => 'e-post',
 706+ 'am-active' => 'aktiv',
 707+ 'am-updated' => 'Dina ändringar har sparats',
 708+);
 709+
 710+/** Telugu (తెలుగు)
 711+ * @author Veeven
 712+ */
 713+$messages['te'] = array(
 714+ 'am-username' => 'వాడుకరిపేరు',
 715+ 'am-email' => 'ఈ-మెయిల్',
 716+ 'nss-save-changes' => 'మార్పులను భద్రపరచు',
 717+ 'nss-create-account-header' => 'కొత్త ఖాతాని సృష్టించండి',
 718+ 'nss-welcome-mail-subject' => 'ఖాతా సృష్టింపు',
 719+);
 720+
 721+/** Tagalog (Tagalog)
 722+ * @author AnakngAraw
 723+ */
 724+$messages['tl'] = array(
 725+ 'accountmanager' => 'Tagapamahala ng kuwenta',
 726+ 'am-username' => 'pangalan ng tagagamit',
 727+ 'am-email' => 'e-liham',
 728+ 'am-active' => 'masigla (aktibo)',
 729+ 'am-updated' => 'Matagumpay na nasagip ang iyong mga pagbabago',
 730+ 'nss-desc' => "Isang pampasak (''plug-in'') na makapagpapatunay laban sa isang kalipunan ng datong libnss-mysql. Naglalaman ng isang [[Special:AccountManager|tagapamahala ng kuwenta]]",
 731+ 'nss-rights' => 'mga karapatan',
 732+ 'nss-save-changes' => 'Sagipin ang mga pagbabago',
 733+ 'nss-create-account-header' => 'Lumikha ng bagong kuwenta (akawnt)',
 734+ 'nss-create-account' => 'Likhain ang kuwenta (akawnt)',
 735+ 'nss-no-mail' => 'Huwag ipadala ang e-liham',
 736+ 'nss-welcome-mail' => 'Nilikha para sa iyo ang isang akawnt/kuwentang may pangalan ng tagagamit na $1 at hudyat na $2.',
 737+ 'nss-welcome-mail-subject' => 'Paglikha ng kuwenta',
 738+ 'nss-db-error' => 'Kamalian sa pagbasa mula sa kalipunan ng datong pampagpapatunay',
 739+);
 740+
 741+/** Turkish (Türkçe)
 742+ * @author Karduelis
 743+ */
 744+$messages['tr'] = array(
 745+ 'am-email' => 'e-posta',
 746+);
 747+
 748+/** Veps (Vepsan kel')
 749+ * @author Игорь Бродский
 750+ */
 751+$messages['vep'] = array(
 752+ 'am-username' => 'kävutajan nimi',
 753+ 'am-email' => 'e-počt',
 754+ 'am-active' => 'aktivine',
 755+);
 756+
 757+/** Vietnamese (Tiếng Việt)
 758+ * @author Minh Nguyen
 759+ * @author Vinhtantran
 760+ */
 761+$messages['vi'] = array(
 762+ 'accountmanager' => 'Trình quản lý tài khoản',
 763+ 'am-username' => 'tên người dùng',
 764+ 'am-email' => 'địa chỉ thư điện tử',
 765+ 'am-active' => 'tích cực',
 766+ 'am-updated' => 'Đã lưu các thay đổi của bạn thành công',
 767+ 'nss-desc' => 'Phần bổ trợ để xác nhận tính danh theo cơ sở dữ liệu libnss-mysql, bao gồm [[Special:AccountManager|trình quản lý tài khoản]]',
 768+ 'nss-rights' => 'quyền',
 769+ 'nss-save-changes' => 'Lưu các thay đổi',
 770+ 'nss-create-account-header' => 'Mở tài khoản mới',
 771+ 'nss-create-account' => 'Mở tài khoản',
 772+ 'nss-no-mail' => 'Không gửi thư điện tử',
 773+ 'nss-welcome-mail' => 'Bạn đã mở tài khoản với tên $1 và mật khẩu $2.',
 774+ 'nss-welcome-mail-subject' => 'Tài khoản mới',
 775+ 'nss-db-error' => 'Lỗi truy cập cơ sở dữ liệu tài khoản',
 776+);
 777+
 778+/** Volapük (Volapük)
 779+ * @author Smeira
 780+ */
 781+$messages['vo'] = array(
 782+ 'accountmanager' => 'Kaliguvöm',
 783+ 'am-username' => 'gebananem',
 784+ 'am-email' => 'pot leäktronik',
 785+ 'am-active' => 'jäfedik',
 786+ 'am-updated' => 'Votükams olik pedakipons benosekiko',
 787+ 'nss-rights' => 'gitäts',
 788+ 'nss-save-changes' => 'Dakipön votükamis',
 789+ 'nss-create-account-header' => 'Jafön kali nulik',
 790+ 'nss-create-account' => 'Jafön kali',
 791+ 'nss-no-mail' => 'No sedolös poti leäktronik',
 792+ 'nss-welcome-mail' => 'Kal labü gebananem: $1 e letavöd: $2 pejafon ole.',
 793+ 'nss-welcome-mail-subject' => 'Kalijafam',
 794+);
 795+
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuth.i18n.php
___________________________________________________________________
Name: svn:eol-style
1796 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuthPlugin.php
@@ -0,0 +1,238 @@
 2+<?php
 3+
 4+/*
 5+ * A plugin to authenticate against a libnss-mysql database
 6+ *
 7+ * Copyright 2008 - Bryan Tong Minh / Delft Aerospace Rocket Engineering
 8+ * Licensed under the terms of the GNU General Public License, version 2
 9+ * or any later version.
 10+ *
 11+ */
 12+
 13+class NssMySQLAuthPlugin extends AuthPlugin {
 14+ static function initialize() {
 15+ global $wgAuth, $wgHooks, $wgGroupPermissions;
 16+ global $wgNssMySQLAuthDB;
 17+ $wgAuth = new self( $wgNssMySQLAuthDB );
 18+
 19+ $wgHooks['UserEffectiveGroups'][] = array( $wgAuth, 'onUserEffectiveGroups' );
 20+ $wgHooks['UserGetEmail'][] = array( $wgAuth, 'onUserGetEmail' );
 21+ $wgHooks['UserSetEmail'][] = array( $wgAuth, 'onUserSetEmail' );
 22+ $wgHooks['UserRights'][] = array( $wgAuth, 'onUserRights' );
 23+
 24+ foreach ( $wgAuth->getAllGroups() as $group ) {
 25+ if ( !isset( $wgGroupPermissions[$group] ) )
 26+ $wgGroupPermissions[$group] = array();
 27+ }
 28+
 29+ wfLoadExtensionMessages( 'nssmysqlauth' );
 30+ }
 31+
 32+ function __construct( $wikiName = false ) {
 33+ $this->wikiName = $wikiName;
 34+ $this->users = array();
 35+ }
 36+
 37+ function getDB( $db = DB_LAST ) {
 38+ return wfGetDB( $db, array(), $this->wikiName );
 39+ }
 40+
 41+ function userExists( $username ) {
 42+ $this->loadUser( $username );
 43+ return $this->users[$username] !== false;
 44+ }
 45+ function getUid( $username ) {
 46+ $this->loadUser( $username );
 47+ return $this->users[$username];
 48+ }
 49+
 50+ function loadUser( $username ) {
 51+ if ( isset( $this->users[$username] ) )
 52+ return;
 53+ $dbr = $this->getDB( DB_READ );
 54+ $row = $dbr->selectRow(
 55+ 'passwd', 'pwd_uid', array( 'pwd_name' => $username ),
 56+ __METHOD__
 57+ );
 58+ $this->users[$username] = ($row === false ? false : $row->pwd_uid);
 59+ }
 60+
 61+ function authenticate( $username, $password ) {
 62+ $dbr = $this->getDB( DB_READ );
 63+ $res = $dbr->selectRow(
 64+ 'passwd',
 65+ array( 'pwd_name', 'pwd_password' ),
 66+ array( 'pwd_name' => $username ),
 67+ __METHOD__
 68+ );
 69+ if( $res === false ) return false;
 70+
 71+ return Md5crypt::encryptPassword( $password, $res->pwd_password )
 72+ == $res->pwd_password;
 73+ }
 74+
 75+ function updateUser( &$user ) {
 76+ $dbr = $this->getDB( DB_READ );
 77+ $res = $dbr->selectRow(
 78+ 'passwd',
 79+ array( 'pwd_email' ),
 80+ array( 'pwd_name' => $user->getName() ),
 81+ __METHOD__
 82+ );
 83+
 84+ if( $res === false ) return true;
 85+
 86+ $user->setEmail( $res->pwd_email );
 87+ return true;
 88+ }
 89+
 90+ function autoCreate() {
 91+ return true;
 92+ }
 93+ function setPassword( $user, $password ) {
 94+ $encryptedPassword = Md5crypt::encryptPassword( $password );
 95+ $dbw = $this->getDB( DB_WRITE );
 96+ return true == $dbw->update(
 97+ 'passwd',
 98+ array(
 99+ 'pwd_password' => $encryptedPassword,
 100+ 'pwd_password_lastchange' => wfTimestamp( TS_UNIX ),
 101+ ),
 102+ array( 'pwd_name' => $user->getName() ),
 103+ __METHOD__
 104+ );
 105+ }
 106+
 107+ function updateExternalDB( $user ) {
 108+ // Email updated via hook
 109+ return true;
 110+ }
 111+
 112+ function canCreateAccounts() {
 113+ return false;
 114+ }
 115+
 116+ function addUser( $user, $password, $email='', $realname='' ) {
 117+ return false;
 118+ }
 119+
 120+ function strict() {
 121+ return false;
 122+ }
 123+
 124+ function onUserEffectiveGroups( &$user, &$groups ) {
 125+ if( !$this->userExists( $user->getName() ) )
 126+ return true;
 127+
 128+ $dbr = $this->getDB( DB_READ );
 129+ $res = $dbr->select(
 130+ array( 'passwd', 'group_membership' ),
 131+ array( 'gm_group' ),
 132+ array( 'pwd_uid = gm_user', 'pwd_name' => $user->getName() ),
 133+ __METHOD__
 134+ );
 135+ while( $row = $res->fetchObject() )
 136+ $groups[] = $row->gm_group;
 137+
 138+ return true;
 139+ }
 140+
 141+ function onUserGetEmail( $user, &$address ) {
 142+ if( !$this->userExists( $user->getName() ) )
 143+ return true;
 144+
 145+ $dbr = $this->getDB( DB_READ );
 146+ $row = $dbr->selectRow( 'passwd' , 'pwd_email',
 147+ array( 'pwd_name' => $user->getName() ) );
 148+ if( $row ) $address = $row->pwd_email;
 149+ return true;
 150+
 151+ }
 152+
 153+ function onUserSetEmail( $user, &$address ) {
 154+ if( !$this->userExists( $user->getName() ) )
 155+ return true;
 156+
 157+ $dbw = $this->getDB( DB_WRITE );
 158+ return true == $dbw->update(
 159+ 'passwd',
 160+ array( 'pwd_email' => $address ),
 161+ array( 'pwd_name' => $user->getName() ),
 162+ __METHOD__
 163+ );
 164+ }
 165+
 166+ function onUserRights( &$user, $addgroup, $removegroup ) {
 167+ $uid = $this->getUid( $user->getName() );
 168+ if( $uid === false )
 169+ return true;
 170+
 171+ $dbr = $this->getDB( DB_READ );
 172+ $res = $dbr->select( 'groups', 'grp_name', array(), __METHOD__ );
 173+ $groups = array();
 174+ while ( $row = $res->fetchObject() )
 175+ $groups[] = $row->grp_name;
 176+ $res->free();
 177+
 178+ $addgroup = array_intersect( $groups, $addgroup );
 179+ $removegroup = array_intersect( $groups, $removegroup );
 180+
 181+ $dbw = $this->getDB( DB_WRITE );
 182+ foreach ( $addgroup as $group )
 183+ $dbw->insert( 'group_membership', array(
 184+ 'gm_user' => $uid,
 185+ 'gm_group' => $group,
 186+ ), __METHOD__, 'IGNORE' );
 187+ foreach ( $removegroup as $group )
 188+ $dbw->delete( 'group_membership', array(
 189+ 'gm_user' => $uid,
 190+ 'gm_group' => $group,
 191+ ), __METHOD__ );
 192+ return true;
 193+ }
 194+
 195+ /**
 196+ * Create an account, returning a random password
 197+ */
 198+ function createAccount( $username, $options ) {
 199+ global $wgDefaultGid, $wgHomeDirectory;
 200+ $password = User::randomPassword();
 201+
 202+ $insert = array(
 203+ 'pwd_name' => strtolower( $username ),
 204+ 'pwd_password' => Md5crypt::encryptPassword( $password ),
 205+ 'pwd_password_lastchange' => wfTimestamp( TS_UNIX ),
 206+ 'pwd_gid' => $wgDefaultGid,
 207+ 'pwd_home' => str_replace( '$1', strtolower( $username ), $wgHomeDirectory )
 208+ );
 209+
 210+ // $options is something that is passed to user_props
 211+ $insert['pwd_email'] = $options['email'];
 212+ $insert['pwd_active'] = $options['active'];
 213+
 214+ // Guess a nice uid. We actually need a lock here
 215+ $dbw = $this->getDB( DB_MASTER );
 216+ $row = $dbw->selectRow( 'passwd', 'MAX(pwd_uid) + 1 AS uid', array(), __METHOD__ );
 217+ $uid = $row->uid;
 218+ if ( function_exists( 'posix_getpwuid' ) ) {
 219+ while( posix_getpwuid( $uid ) )
 220+ $uid++;
 221+ }
 222+
 223+ $insert['pwd_uid'] = $uid;
 224+
 225+ $dbw->insert( 'passwd', $insert, __METHOD__ );
 226+
 227+ return $password;
 228+ }
 229+
 230+ function getAllGroups() {
 231+ $dbr = $this->getDB( DB_SLAVE );
 232+ $res = $dbr->select( 'groups', 'grp_name', array(), __METHOD__ );
 233+ $groups = array();
 234+ while ( $row = $res->fetchObject() )
 235+ $groups[] = $row->grp_name;
 236+ $res->free();
 237+ return $groups;
 238+ }
 239+}
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuthPlugin.php
___________________________________________________________________
Name: svn:eol-style
1240 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuth.php
@@ -0,0 +1,45 @@
 2+<?php
 3+
 4+/*
 5+ * A plugin to authenticate against a libnss-mysql database
 6+ *
 7+ * Copyright 2008 - Bryan Tong Minh / Delft Aerospace Rocket Engineering
 8+ * Licensed under the terms of the GNU General Public License, version 2
 9+ * or any later version.
 10+ *
 11+ */
 12+
 13+ ### READ BEFORE USING ###
 14+/*
 15+ * This plugin allows authentication against an libnss-mysql database and thus
 16+ * allows the use of the same login for MediaWiki as for shell.
 17+ *
 18+ */
 19+
 20+$wgExtensionCredits['other'][] = array(
 21+ 'name' => 'NssMySQLAuth',
 22+ 'version' => '1.0',
 23+ 'author' => 'Bryan Tong Minh',
 24+ 'description' => 'A plugin to authenticate against a libnss-mysql database. Contains an [[Special:AccountManager|account manager]]',
 25+ 'descriptionmsg' => 'nss-desc',
 26+ 'url' => 'http://www.mediawiki.org/wiki/Extension:NssMySQLAuth',
 27+);
 28+
 29+$dir = dirname( __FILE__ ) . '/';
 30+$wgExtensionMessagesFiles['nssmysqlauth'] = $dir . 'NssMySQLAuth.i18n.php';
 31+$wgExtensionAliasesFiles['nssmysqlauth'] = $dir . 'NssMySQLAuth.alias.php';
 32+
 33+$wgAutoloadClasses['NssMySQLAuthPlugin'] = $dir . 'NssMySQLAuthPlugin.php';
 34+$wgAutoloadClasses['Md5crypt'] = $dir . 'Md5crypt.php';
 35+$wgAutoloadClasses['SpecialAccountManager'] = $dir . 'SpecialAccountManager.php';
 36+$wgSpecialPages['AccountManager'] = 'SpecialAccountManager';
 37+
 38+$wgNssMySQLAuthDB = false;
 39+
 40+$wgExtensionFunctions[] = array( 'NssMySQLAuthPlugin', 'initialize' );
 41+
 42+$wgUserProperties = array( 'address', 'city' );
 43+$wgActivityModes = array( 'active', 'inactive' );
 44+
 45+$wgDefaultGid = 1001;
 46+$wgHomeDirectory = '/home/$1';
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuth.php
___________________________________________________________________
Name: svn:eol-style
147 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/tables.sql
@@ -0,0 +1,59 @@
 2+CREATE DATABASE nss_auth;
 3+
 4+USE nss_auth;
 5+
 6+CREATE TABLE passwd (
 7+ pwd_uid int not null,
 8+ pwd_name varchar(255),
 9+ pwd_password varbinary(255),
 10+ pwd_password_lastchange int not null,
 11+ pwd_gid int not null,
 12+ pwd_home varchar(255) default null,
 13+ pwd_shell varchar(255) default '/bin/sh',
 14+ pwd_active varchar(15) default 1,
 15+ pwd_email varchar(255) not null,
 16+
 17+ PRIMARY KEY (pwd_uid),
 18+ UNIQUE INDEX (pwd_name)
 19+) character set ascii collate ascii_general_ci;
 20+
 21+CREATE TABLE groups (
 22+ grp_gid int not null,
 23+ grp_name varchar(255),
 24+ grp_password varchar(255) not null,
 25+
 26+ PRIMARY KEY(grp_gid),
 27+ INDEX (grp_name)
 28+) character set ascii collate ascii_general_ci;
 29+
 30+CREATE TABLE group_membership (
 31+ gm_user int not null,
 32+ gm_group varchar(255),
 33+
 34+ PRIMARY KEY (gm_user, gm_group),
 35+ KEY (gm_group)
 36+) character set ascii collate ascii_general_ci;
 37+
 38+CREATE TABLE permission (
 39+ perm_user int not null,
 40+ perm_action varbinary(255),
 41+ perm_permission varbinary(255)
 42+) character set ascii collate ascii_general_ci;
 43+
 44+CREATE TABLE user_props (
 45+ up_user varchar(255),
 46+ up_timestamp binary(14),
 47+ up_name varchar(255),
 48+ up_value blob,
 49+
 50+ INDEX(up_name),
 51+ INDEX(up_user, up_timestamp)
 52+) character set ascii collate ascii_general_ci;
 53+
 54+GRANT USAGE ON nss_auth.* TO `nss-root`@`localhost` IDENTIFIED BY 'secretpassword';
 55+GRANT USAGE ON nss_auth.* TO `nss-user`@`localhost` IDENTIFIED BY 'publiclyviewablepassword';
 56+
 57+GRANT SELECT ON nss_auth.* TO `nss-root`@`localhost`;
 58+GRANT SELECT (pwd_uid, pwd_name, pwd_gid, pwd_home, pwd_shell, pwd_active) ON nss_auth.passwd TO `nss-user`@`localhost`;
 59+GRANT SELECT ON nss_auth.groups TO `nss-user`@`localhost`;
 60+GRANT SELECT ON nss_auth.group_membership TO `nss-user`@`localhost`;
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/tables.sql
___________________________________________________________________
Name: svn:eol-style
161 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuth.alias.php
@@ -0,0 +1,109 @@
 2+<?php
 3+/**
 4+ * Aliases for special pages
 5+ */
 6+
 7+$aliases = array();
 8+
 9+/** English
 10+ * @author Bryan Tong Minh
 11+ */
 12+$aliases['en'] = array(
 13+ 'AccountManager' => array( 'AccountManager' ),
 14+);
 15+
 16+/** Arabic (العربية) */
 17+$aliases['ar'] = array(
 18+ 'AccountManager' => array( 'مدير_الحسابات' ),
 19+);
 20+
 21+/** Egyptian Spoken Arabic (مصرى) */
 22+$aliases['arz'] = array(
 23+ 'AccountManager' => array( 'مدير_الحسابات' ),
 24+);
 25+
 26+/** Bosnian (Bosanski) */
 27+$aliases['bs'] = array(
 28+ 'AccountManager' => array( 'UpravljanjeRacunima' ),
 29+);
 30+
 31+/** German (Deutsch) */
 32+$aliases['de'] = array(
 33+ 'AccountManager' => array( 'Account-Manager' ),
 34+);
 35+
 36+/** Lower Sorbian (Dolnoserbski) */
 37+$aliases['dsb'] = array(
 38+ 'AccountManager' => array( 'Kontowy zastojnik' ),
 39+);
 40+
 41+/** French (Français) */
 42+$aliases['fr'] = array(
 43+ 'AccountManager' => array( 'Gestionnaire de compte', 'GestionnaireDeCompte' ),
 44+);
 45+
 46+/** Galician (Galego) */
 47+$aliases['gl'] = array(
 48+ 'AccountManager' => array( 'Xestor de contas' ),
 49+);
 50+
 51+/** Upper Sorbian (Hornjoserbsce) */
 52+$aliases['hsb'] = array(
 53+ 'AccountManager' => array( 'Kontowy zrjadowak' ),
 54+);
 55+
 56+/** Interlingua (Interlingua) */
 57+$aliases['ia'] = array(
 58+ 'AccountManager' => array( 'Gestion de contos' ),
 59+);
 60+
 61+/** Japanese (日本語) */
 62+$aliases['ja'] = array(
 63+ 'AccountManager' => array( 'アカウントマネージャー' ),
 64+);
 65+
 66+/** Khmer (ភាសាខ្មែរ) */
 67+$aliases['km'] = array(
 68+ 'AccountManager' => array( 'គ្រប់គ្រង​គណនី' ),
 69+);
 70+
 71+/** Nedersaksisch (Nedersaksisch) */
 72+$aliases['nds-nl'] = array(
 73+ 'AccountManager' => array( 'Gebrukersbeheer' ),
 74+);
 75+
 76+/** Dutch (Nederlands) */
 77+$aliases['nl'] = array(
 78+ 'AccountManager' => array( 'Gebruikersbeheer' ),
 79+);
 80+
 81+/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬) */
 82+$aliases['no'] = array(
 83+ 'AccountManager' => array( 'Kontobehandling' ),
 84+);
 85+
 86+/** Brazilian Portuguese (Português do Brasil) */
 87+$aliases['pt-br'] = array(
 88+ 'AccountManager' => array( 'Gerenciador de contas' ),
 89+);
 90+
 91+/** Sanskrit (संस्कृत) */
 92+$aliases['sa'] = array(
 93+ 'AccountManager' => array( 'उपयोजकसंज्ञाप्रबन्धक' ),
 94+);
 95+
 96+/** Albanian (Shqip) */
 97+$aliases['sq'] = array(
 98+ 'AccountManager' => array( 'MenaxhuesLlogarie' ),
 99+);
 100+
 101+/** Swahili (Kiswahili) */
 102+$aliases['sw'] = array(
 103+ 'AccountManager' => array( 'AkauntiKuu' ),
 104+);
 105+
 106+/** Tagalog (Tagalog) */
 107+$aliases['tl'] = array(
 108+ 'AccountManager' => array( 'Tagapamahala ng akawnt' ),
 109+);
 110+
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/NssMySQLAuth.alias.php
___________________________________________________________________
Name: svn:keywords
1111 + Id
Name: svn:eol-style
2112 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/libnss-mysql.cfg
@@ -0,0 +1,16 @@
 2+getpwnam SELECT pwd_name, 'x', pwd_uid, pwd_gid, '', pwd_home, pwd_shell FROM passwd WHERE pwd_name = '%1$s' LIMIT 1
 3+getpwuid SELECT pwd_name, 'x', pwd_uid, pwd_gid, '', pwd_home, pwd_shell FROM passwd WHERE pwd_uid = '%1$u' LIMIT 1
 4+getspnam SELECT pwd_name, pwd_password, pwd_password_lastchange, 0, 3650000, 7, -1, -1, 0 FROM passwd WHERE pwd_name = '%1$s' LIMIT 1
 5+getpwent SELECT pwd_name, 'x', pwd_uid, pwd_gid, '', pwd_home, pwd_shell FROM passwd
 6+getspent SELECT pwd_name, pwd_password, pwd_password_lastchange, 0, 3650000, 7, -1, -1, 0 FROM passwd
 7+getgrnam SELECT grp_name, grp_password, grp_gid FROM groups WHERE grp_name = '%1$u' LIMIT 1
 8+getgrgid SELECT grp_name, grp_password, grp_gid FROM groups WHERE grp_gid = '%1$u' LIMIT 1
 9+getgrent SELECT grp_name, grp_password, grp_gid FROM groups
 10+memsbygid SELECT pwd_name FROM group_membership, groups, passwd WHERE gm_group = grp_name AND gm_user = pwd_uid AND grp_gid = '%1$u'
 11+gidsbymem SELECT grp_gid FROM group_membership, groups, passwd WHERE gm_group = grp_name AND gm_user = pwd_uid AND pwd_name = '%1$s'
 12+
 13+host localhost
 14+database nss_auth
 15+username nss-user
 16+password publiclyviewablepassword
 17+socket /var/run/mysqld/mysqld.sock
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/libnss-mysql.cfg
___________________________________________________________________
Name: svn:eol-style
118 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/migrateGroup.php
@@ -0,0 +1,66 @@
 2+<?php
 3+
 4+require_once( 'commandLine.inc' );
 5+
 6+function migrateGroup( $group ) {
 7+ $groups = parseGroupFile();
 8+
 9+ if ( !isset( $groups[$group] ) )
 10+ return false;
 11+ $group = $groups[$group];
 12+
 13+ global $wgAuth;
 14+ $dbw = $wgAuth->getDB( DB_WRITE );
 15+ if ( false == $dbw->insert( 'groups', array(
 16+ 'grp_name' => $group['name'],
 17+ 'grp_password' => $group['password'],
 18+ 'grp_gid' => $group['gid'],
 19+ ), __METHOD__ ) )
 20+ return false;
 21+ foreach ( $group['members'] as $user ) {
 22+ $pwd = posix_getpwnam( $user );
 23+ if ( !$pwd )
 24+ return false;
 25+ print "Migrating {$pwd['name']}\n";
 26+ if ( false == $dbw->insert( 'group_membership', array(
 27+ 'gm_group' => $group['name'],
 28+ 'gm_user' => $pwd['uid']
 29+ ), __METHOD__ ) ) {
 30+
 31+ $dbw->rollback();
 32+ return false;
 33+ }
 34+ }
 35+
 36+ $dbw->immediateCommit();
 37+ wfDoUpdates();
 38+ return true;
 39+}
 40+
 41+function parseGroupFile() {
 42+ $file = fopen( '/etc/group', 'r' );
 43+ $groups = array();
 44+ while ( $line = fgets( $file ) ) {
 45+ $entry = explode( ':', trim( $line ) );
 46+ $groups[$entry[0]] = array(
 47+ 'name' => $entry[0],
 48+ 'password' => $entry[1],
 49+ 'gid' => $entry[2],
 50+ 'members' => explode( ',', $entry[3] )
 51+ );
 52+ }
 53+ return $groups;
 54+}
 55+
 56+if ( !isset( $args ) || count( $args ) < 1 ) {
 57+ print "Usage: php migrateGroup.php <group>\n";
 58+ exit(1);
 59+}
 60+
 61+if( migrateGroup( $args[0] ) ) {
 62+ print "Group '{$args[0]}' succesfully migrated!\n";
 63+ exit(0);
 64+} else {
 65+ print "Migration failed!\n";
 66+ exit(1);
 67+}
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/migrateGroup.php
___________________________________________________________________
Name: svn:eol-style
168 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/Md5crypt.php
@@ -0,0 +1,145 @@
 2+<?php
 3+
 4+/*
 5+
 6+md5crypt.php5
 7+--------------
 8+Modified by
 9+ - Bryan Tong Minh
 10+
 11+Written by
 12+
 13+ - Dennis Riehle <selfhtml@riehle-web.com>
 14+
 15+Based on
 16+
 17+ - perl's Crypt::PasswdMD5 by Luis Munoz (lem@cantv.net)
 18+ - phyton's md5crypt.py by Michal Wallace http://www.sabren.com/
 19+ - /usr/src/libcrypt/crypt.c from FreeBSD 2.2.5-RELEASE
 20+
 21+Many thanks to
 22+
 23+ - Fabian Steiner <info@fabis-site.net>
 24+ without him this script would not work!!
 25+
 26+Version: 1.0 stable
 27+Last edit: Tue, 13 September 2005 13:49:28 GMT
 28+
 29+
 30+USAGE
 31+
 32+ $cryptedpassword = md5crypt_unix ($password [, $salt [, $magicstring ]);
 33+ $apachepassword = md5crypt_apache ($password [, $salt]);
 34+
 35+DESCRIPTION
 36+
 37+ unix_md5_crypt() provides a crypt()-compatible interface to the
 38+ rather new MD5-based crypt() function found in modern operating systems.
 39+ It's based on the implementation found on FreeBSD 2.2.[56]-RELEASE and
 40+ contains the following license in it:
 41+
 42+ "THE BEER-WARE LICENSE" (Revision 42):
 43+ <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
 44+ can do whatever you want with this stuff. If we meet some day, and you think
 45+ this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
 46+
 47+ apache_md5_crypt() provides a function compatible with Apache's
 48+ .htpasswd files. This was contributed by Bryan Hart <bryan@eai.com>.
 49+
 50+*/
 51+
 52+class Md5crypt {
 53+ private static $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
 54+
 55+ static function to64($v, $n) {
 56+ $ret = '';
 57+
 58+ while(--$n >= 0) {
 59+ $ret .= self::$itoa64{$v & 0x3f};
 60+ $v = $v >> 6;
 61+ }
 62+ return $ret;
 63+ }
 64+
 65+ static function encryptPassword($pw, $salt = NULL, $Magic = '$1$') {
 66+ if($salt !== NULL) {
 67+ // Take care of the magic string if present
 68+ if(substr($salt, 0, strlen($Magic)) == $Magic) {
 69+ $salt = substr($salt, strlen($Magic), strlen($salt));
 70+ }
 71+ // Salt can have up to 8 characters
 72+ $parts = explode('$', $salt, 1);
 73+ $salt = substr($parts[0], 0, 8);
 74+ } else {
 75+ $salt = '';
 76+ mt_srand((double)(microtime() * 10000000));
 77+
 78+ while(strlen($salt) < 8) {
 79+ $salt .= self::$itoa64{mt_rand(0, strlen(self::$itoa64))};
 80+ }
 81+ }
 82+
 83+ $ctx = $pw . $Magic . $salt;
 84+
 85+ $final = pack('H*', md5($pw . $salt . $pw));
 86+
 87+ for ($pl = strlen($pw); $pl > 0; $pl -= 16) {
 88+ $ctx .= substr($final, 0, ($pl > 16) ? 16 : $pl);
 89+ }
 90+
 91+ // Now the 'weird' xform
 92+ for($i = strlen($pw); $i; $i >>= 1) {
 93+ if($i & 1) { // This comes from the original version,
 94+ $ctx .= pack("C", 0); // where a memset() is done to $final
 95+ } else { // before this loop
 96+ $ctx .= $pw{0};
 97+ }
 98+ }
 99+
 100+ $final = pack('H*', md5($ctx)); // The following is supposed to make
 101+ // things run slower
 102+
 103+ for($i = 0; $i < 1000; $i++) {
 104+ $ctx1 = '';
 105+ if($i & 1) {
 106+ $ctx1 .= $pw;
 107+ } else {
 108+ $ctx1 .= substr($final, 0, 16);
 109+ }
 110+ if($i % 3) {
 111+ $ctx1 .= $salt;
 112+ }
 113+ if($i % 7) {
 114+ $ctx1 .= $pw;
 115+ }
 116+ if($i & 1) {
 117+ $ctx1 .= substr($final, 0, 16);
 118+ } else {
 119+ $ctx1 .= $pw;
 120+ }
 121+ $final = pack('H*', md5($ctx1));
 122+ }
 123+
 124+ // Final xform
 125+ $passwd = '';
 126+ $passwd .= self::to64((intval(ord($final{0})) << 16)
 127+ |(intval(ord($final{6})) << 8)
 128+ |(intval(ord($final{12}))),4);
 129+ $passwd .= self::to64((intval(ord($final{1})) << 16)
 130+ |(intval(ord($final{7})) << 8)
 131+ |(intval(ord($final{13}))), 4);
 132+ $passwd .= self::to64((intval(ord($final{2})) << 16)
 133+ |(intval(ord($final{8})) << 8)
 134+ |(intval(ord($final{14}))), 4);
 135+ $passwd .= self::to64((intval(ord($final{3})) << 16)
 136+ |(intval(ord($final{9})) << 8)
 137+ |(intval(ord($final{15}))), 4);
 138+ $passwd .= self::to64((intval(ord($final{4}) << 16)
 139+ |(intval(ord($final{10})) << 8)
 140+ |(intval(ord($final{5})))), 4);
 141+ $passwd .= self::to64((intval(ord($final{11}))), 2);
 142+
 143+ // Return the final string
 144+ return $Magic . $salt . '$' . $passwd;
 145+ }
 146+}
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/Md5crypt.php
___________________________________________________________________
Name: svn:eol-style
1147 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/migrateUser.php
@@ -0,0 +1,63 @@
 2+<?php
 3+
 4+require_once( 'commandLine.inc' );
 5+
 6+function migrateUser( $username, $email ) {
 7+ $pwd = posix_getpwnam( $username );
 8+ if ( !$pwd ) return false;
 9+
 10+ // PHP sucks
 11+ list( $password, $password_lastchange ) = getspwd( $username );
 12+ if ( is_null( $password ) || is_null( $password_lastchange ) )
 13+ return false;
 14+
 15+ global $wgAuth;
 16+ $dbw = $wgAuth->getDB( DB_WRITE );
 17+ if ( false == $dbw->insert( 'passwd', array(
 18+ 'pwd_uid' => $pwd['uid'],
 19+ 'pwd_name' => $pwd['name'],
 20+ 'pwd_password' => $password,
 21+ 'pwd_password_lastchange' => $password_lastchange,
 22+ 'pwd_gid' => $pwd['gid'],
 23+ 'pwd_home' => $pwd['dir'],
 24+ 'pwd_shell' => $pwd['shell'],
 25+ 'pwd_active' => 'active',
 26+ 'pwd_email' => $email
 27+ ), __METHOD__ ) )
 28+ return false;
 29+ if ( false == $dbw->insert( 'user_props', array(
 30+ 'up_timestamp' => $dbw->timestamp(),
 31+ 'up_user' => $username,
 32+ 'up_name' => 'email',
 33+ 'up_value' => $email
 34+ ), __METHOD__ ) )
 35+ return false;
 36+
 37+ $dbw->immediateCommit();
 38+ wfDoUpdates();
 39+ return true;
 40+}
 41+
 42+function getspwd( $username ) {
 43+ $shadow = fopen( '/etc/shadow', 'r' );
 44+ while( $line = fgets( $shadow ) ) {
 45+ $entry = explode( ':', trim( $line ) );
 46+ if ( $entry && $entry[0] == $username )
 47+ return array( $entry[1], $entry[2] );
 48+ }
 49+ fclose( $shadow );
 50+ return array( null, null );
 51+}
 52+
 53+if ( !isset( $args ) || count( $args ) < 2 ) {
 54+ print "Usage: php migrateUser.php <username> <email>\n";
 55+ exit(1);
 56+}
 57+
 58+if( migrateUser( $args[0], $args[1] ) ) {
 59+ print "User '{$args[0]}' succesfully migrated!\n";
 60+ exit(0);
 61+} else {
 62+ print "Migration failed!\n";
 63+ exit(1);
 64+}
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/migrateUser.php
___________________________________________________________________
Name: svn:eol-style
165 + native
Index: branches/NssMySQLAuth-rewrite/NssMySQLAuth/SpecialAccountManager.php
@@ -0,0 +1,390 @@
 2+<?php
 3+
 4+class SpecialAccountManager extends SpecialPage {
 5+ function __construct() {
 6+ parent::__construct( 'AccountManager', 'accountmanager', false );
 7+ $this->mErrors = array();
 8+ }
 9+
 10+ function execute() {
 11+ global $wgUser;
 12+ if( !$this->userCanExecute( $wgUser ) )
 13+ return $this->displayRestrictionError();
 14+
 15+ $this->setHeaders();
 16+
 17+ $this->users = UserProps::fetchAllUsers();
 18+ if( $this->processData() === true )
 19+ $this->showSuccess();
 20+ if( $this->processCreateAccount() === true )
 21+ $this->showSuccessCreate();
 22+
 23+ $this->showErrors();
 24+
 25+ $this->constructForm();
 26+ $this->constructCreateForm();
 27+ }
 28+
 29+ function showSuccess() {
 30+ global $wgOut;
 31+ $wgOut->addHTML( Xml::element('p', array(), wfMsg( 'am-updated' ) ) );
 32+ }
 33+ function showSuccessCreate() {
 34+ return $this->showSuccess();
 35+ }
 36+
 37+ function constructForm() {
 38+ global $wgOut, $wgScript, $wgUser;
 39+ global $wgUserProperties, $wgActivityModes;
 40+
 41+ // TODO: wfMsg etc.
 42+ $wgOut->addHTML( Xml::openElement( 'form', array(
 43+ 'action' => $this->getTitle()->getLocalURL(),
 44+ 'method' => 'post' )
 45+ ) );
 46+
 47+ $wgOut->addHTML("<table id=\"userprops\" border=\"1\">\n\t<tr>".
 48+ "<th>".wfMsgHtml( 'am-username' ).
 49+ "</th><th></th><th>".wfMsgHtml( 'am-email' ).
 50+ "</th><th>".wfMsgHtml( 'am-active' )."</th>");
 51+ foreach( $wgUserProperties as $i ) {
 52+ $msg = 'am-'.$i;
 53+ $wgOut->addHTML( Xml::element( 'th', null,
 54+ wfEmptyMsg( $msg, wfMsg( $msg ) ) ? $i : wfMsgHtml( $msg ) ) );
 55+ }
 56+ $wgOut->addHTML("</tr>\n\n");
 57+
 58+ $sk = $wgUser->getSkin();
 59+ foreach( $this->users as $user ) {
 60+ $name = $user->getName();
 61+ $row = "\t<tr>";
 62+ $row .= Xml::element( 'td', null, $name );
 63+ $row .= "<td>".$sk->link( SpecialPage::getTitleFor( 'Userrights' ),
 64+ wfMsg( 'nss-rights' ), array(), array( 'user' => $name ) )."</td>";
 65+ $row .= "<td>".Xml::input( "am-{$name}-email", 30, $user->getEmail() )."</td>";
 66+ $select = new XmlSelect( "am-{$name}-active" );
 67+ $select->setDefault( $user->getActive() );
 68+ foreach( $wgActivityModes as $key )
 69+ $select->addOption( $key );
 70+ $row .= "<td>".$select->getHTML()."</td>";
 71+
 72+ $props = $user->getProps();
 73+ foreach( $wgUserProperties as $key ) {
 74+ $value = isset( $props[$key] ) ? $props[$key] : '';
 75+ $row .= "<td>".Xml::input(
 76+ "am-{$name}-".str_replace( ' ', '_', $key ), 30, $value
 77+ )."</td>";
 78+ }
 79+ $row .= "</tr>\n";
 80+ $wgOut->addHTML( $row );
 81+ }
 82+
 83+ $wgOut->addHTML( "</table>\n" );
 84+ $wgOut->addHTML( "<div id=\"userprops-submit\">\n".
 85+ Xml::hidden( 'action', 'submit' ).
 86+ Xml::element( 'input', array(
 87+ 'type' => 'submit',
 88+ 'value' => wfMsg( 'nss-save-changes' )
 89+ ) ).
 90+ "</div>\n</form>"
 91+ );
 92+ }
 93+
 94+ function constructCreateForm() {
 95+ global $wgOut, $wgScript;
 96+ global $wgUserProperties, $wgActivityModes;
 97+
 98+ $wgOut->addHTML( Xml::openElement( 'form', array(
 99+ 'action' => $this->getTitle()->getLocalURL(),
 100+ 'method' => 'post' )
 101+ ) );
 102+
 103+ $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'nss-create-account-header' ) )."\n" );
 104+
 105+ $wgOut->addHTML( "<table border=\"1\" id=\"newuser\">\n" );
 106+
 107+ $props = array_merge( array( 'username', 'email' ), $wgUserProperties );
 108+ foreach( $props as $i ) {
 109+ $msg = 'am-'.$i;
 110+ $wgOut->addHTML( "\t<tr><th>".
 111+ (wfEmptyMsg( $msg, wfMsg( $msg ) ) ? $i : wfMsgHtml( $msg )).
 112+ "</th><td>".Xml::input( "am-".str_replace( ' ', '_', $i ), 40 ).
 113+ "</td></tr>\n"
 114+ );
 115+ }
 116+
 117+ global $wgActivityModes;
 118+ $select = new XmlSelect( "am-active" );
 119+ $select->setDefault( 'active' );
 120+ $select->setAttribute( 'width', '100%' );
 121+ foreach( $wgActivityModes as $key )
 122+ $select->addOption( $key );
 123+ $wgOut->addHTML( "\t<tr><th>".wfMsgHtml( 'am-active' ).
 124+ "</th><td>".$select->getHTML()."</td></tr>\n" );
 125+
 126+ $wgOut->addHTML( "</table>\n" );
 127+ $wgOut->addHTML( "<div id=\"newaccount-submit\">\n".
 128+ Xml::hidden( 'action', 'create' ).
 129+ Xml::checkLabel( wfMsg( 'nss-no-mail' ), 'nss-no-mail', 'nss-no-mail' ).
 130+ "<br />\n".
 131+ Xml::element( 'input', array(
 132+ 'type' => 'submit',
 133+ 'value' => wfMsg( 'nss-create-account' )
 134+ ) ).
 135+ "</div>\n</form>\n"
 136+ );
 137+
 138+ $wgOut->addHTML( Xml::openElement( 'form', array(
 139+ 'action' => $this->getTitle()->getLocalURL(),
 140+ 'method' => 'post' )
 141+ ) );
 142+ $wgOut->addHTML( "<div id=\"newaccount-raw\">\n".
 143+ Xml::textarea( 'nss-create-account-raw', '' )."\n".
 144+ Xml::hidden( 'action', 'create-raw' ).
 145+ Xml::checkLabel( wfMsg( 'nss-no-mail' ), 'nss-no-mail', 'nss-no-mail' ).
 146+ "<br />\n".
 147+ Xml::element( 'input', array(
 148+ 'type' => 'submit',
 149+ 'value' => wfMsg( 'nss-create-account' )
 150+ ) ).
 151+ "</div>\n</form>\n"
 152+ );
 153+
 154+ }
 155+
 156+ function processData() {
 157+ global $wgRequest, $wgUserProperties;
 158+ if( !$wgRequest->wasPosted() || $wgRequest->getVal('action') != 'submit' )
 159+ return;
 160+
 161+ $post = $wgRequest->getValues();
 162+ foreach( $post as $key => $value ) {
 163+ if( substr( $key, 0, 3 ) != 'am-' )
 164+ continue;
 165+ $parts = explode( '-', $key, 3 );
 166+ if( count( $parts ) != 3 )
 167+ continue;
 168+
 169+ $username = strtolower( $parts[1] );
 170+ $keyname = str_replace( '_', ' ', strtolower( $parts[2] ) );
 171+
 172+ if( !isset( $this->users[$username] ) )
 173+ continue;
 174+
 175+ if( !in_array( $keyname, $wgUserProperties ) &&
 176+ !in_array( $keyname, array( 'email', 'active' ) ) )
 177+ continue;
 178+
 179+ $this->users[$username]->set( $keyname, $value );
 180+ }
 181+
 182+ foreach( $this->users as $user )
 183+ $user->update();
 184+ return true;
 185+ }
 186+
 187+ function processCreateAccount() {
 188+ global $wgRequest, $wgUserProperties;
 189+ if( !$wgRequest->wasPosted() || $wgRequest->getVal('action') != 'create' )
 190+ return;
 191+
 192+ $options = array();
 193+
 194+ $post = $wgRequest->getValues();
 195+ foreach( $post as $key => $value ) {
 196+ if( substr( $key, 0, 3 ) != 'am-' )
 197+ continue;
 198+ $parts = explode( '-', $key, 2 );
 199+ if( count( $parts ) != 2 )
 200+ continue;
 201+
 202+ $keyname = str_replace( '_', '-', strtolower( $parts[1] ) );
 203+ $options[$keyname] = $value;
 204+ }
 205+ return $this->internalProcessCreateAccount( $options,
 206+ $wgRequest->getCheck( 'nss-no-mail') );
 207+
 208+ }
 209+ function processCreateAccountRaw() {
 210+ global $wgRequest, $wgUserProperties;
 211+ if( !$wgRequest->wasPosted() || $wgRequest->getVal('action') != 'create-raw' )
 212+ return;
 213+
 214+ $data = $wgRequest->getText( 'nss-create-account-raw' );
 215+ $nomail = $wgRequest->getCheck( 'nss-no-mail');
 216+ $lines = explode( "\n", $data );
 217+ foreach ( $lines as $line ) {
 218+ $line = trim( $line );
 219+ $items = explode( "\t", $line );
 220+ if ( count( $items ) == $wgUserProperties + 1 ) {
 221+ $username = array_shift( $items );
 222+ $options = array_combine( $wgUserProperties, $items );
 223+ $options['username'] = $username;
 224+ $this->internalProcessCreateAccount( $options, $nomail );
 225+ }
 226+
 227+ }
 228+
 229+ }
 230+
 231+ function internalProcessCreateAccount( $options, $nomail = false ) {
 232+ if( empty( $options['username'] ) ) {
 233+ $this->mErrors[] = 'noname';
 234+ return false;
 235+ }
 236+ $username = $options['username'];
 237+ unset( $options['username'] );
 238+
 239+ global $wgAuth;
 240+ $password = $wgAuth->createAccount($username, $options);
 241+
 242+ $userprops = UserProps::loadFromDb( $username );
 243+ if ( !$userprops ) {
 244+ $this->mErrors[] = 'nss-db-error';
 245+ return false;
 246+ }
 247+ $this->users[$userprops->getName()] = $userprops;
 248+
 249+ if ( $nomail )
 250+ return true;
 251+
 252+ global $wgPasswordSender;
 253+ $email = wfMsg( 'nss-welcome-mail', $username, $password );
 254+ $mailSubject = wfMsg( 'nss-welcome-mail-subject' );
 255+ $mailFrom = new MailAddress( $wgPasswordSender );
 256+ $mailTo = new MailAddress( User::newFromName( $username ) );
 257+
 258+ $mailResult = UserMailer::send( $mailTo, $mailFrom, $mailSubject, $email );
 259+
 260+ if ( WikiError::isError( $mailResult ) ) {
 261+ $this->mErrors[] = $mailResult->getMessage();
 262+ return false;
 263+ }
 264+
 265+ return true;
 266+ }
 267+
 268+ function showErrors() {
 269+ if ( !$this->mErrors )
 270+ return;
 271+ global $wgOut;
 272+ foreach( $this->mErrors as $error )
 273+ $wgOut->addHTML(
 274+ Xml::element( 'p',
 275+ array( 'class' => 'error' ),
 276+ wfMsg( $error )
 277+ )."\n"
 278+ );
 279+ }
 280+}
 281+
 282+class UserProps {
 283+ static function fetchAllUsers() {
 284+ $users = array();
 285+ $res = self::select();
 286+ while( $row = $res->fetchObject() ) {
 287+ if( !isset( $users[$row->pwd_name] ) )
 288+ $users[$row->pwd_name] = new self( $row->pwd_name, $row->pwd_email );
 289+ $users[$row->pwd_name]->setInternal($row->up_name, $row->up_value);
 290+ }
 291+ $res->free();
 292+ return $users;
 293+ }
 294+ static function loadFromDb( $username ) {
 295+ $res = self::select( $username );
 296+ $row = $res->fetchObject();
 297+ if ( !$row )
 298+ return false;
 299+ return new self( $row->pwd_name, $row->pwd_email, $row->pwd_active );
 300+ }
 301+
 302+ function __construct( $username, $email = null, $active = null ) {
 303+ $this->username = $username;
 304+ $this->props = array();
 305+ $this->email = $email;
 306+ $this->setInternal( 'email', $email );
 307+ $this->active = $active;
 308+ $this->setInternal( 'active', $active );
 309+ }
 310+ function getProps() {
 311+ return $this->props;
 312+ }
 313+ function getName() {
 314+ return $this->username;
 315+ }
 316+ function getEmail() {
 317+ return $this->email;
 318+ }
 319+ function setEmail( $email ) {
 320+ $this->email = $email;
 321+ }
 322+ function getActive() {
 323+ return $this->active;
 324+ }
 325+ function setActive( $active ) {
 326+ $this->active = $active;
 327+ }
 328+
 329+ static function select($username = null) {
 330+ global $wgAuth;
 331+ $dbr = $wgAuth->getDB( DB_READ );
 332+ $where = is_null( $username ) ? array() : array( 'pwd_name' => $username );
 333+
 334+ return $dbr->select(
 335+ array( 'user_props', 'passwd' ),
 336+ array( 'up_name', 'up_value', 'pwd_name', 'pwd_email', 'pwd_active' ),
 337+ $where,
 338+ __METHOD__,
 339+ array( 'ORDER BY' => 'pwd_name ASC, up_timestamp ASC' ),
 340+ array( 'passwd' => array( 'RIGHT JOIN', 'pwd_name = up_user' ) )
 341+ );
 342+ }
 343+
 344+ function set($name, $value) {
 345+ wfDebug( "{$this->username}: $name => $value\n" );
 346+ $this->props[$name] = $value;
 347+ }
 348+ function setInternal($name, $value) {
 349+ if( is_null( $this->props ) ) {
 350+ $this->props = array();
 351+ $this->old_props = array();
 352+ }
 353+ $this->old_props[$name] = $this->props[$name] = $value;
 354+ if( $name == 'active' )
 355+ $this->active = $value;
 356+ if( $name == 'email' )
 357+ $this->email = $value;
 358+ }
 359+
 360+ function update() {
 361+ $diff = array_diff_assoc($this->props, $this->old_props);
 362+ if( !count( $diff ) ) return;
 363+
 364+
 365+ global $wgAuth;
 366+ $dbw = $wgAuth->getDB( DB_WRITE );
 367+ $timestamp = $dbw->timestamp();
 368+
 369+ if( isset( $diff['email'] ) || isset( $diff['active'] ) ) {
 370+ if ( isset( $diff['email'] ) ) $this->email = $diff['email'];
 371+ if ( isset( $diff['active'] ) ) $this->active = $diff['active'];
 372+ $dbw->update( 'passwd',
 373+ array( 'pwd_email' => $this->email, 'pwd_active' => $this->active ),
 374+ array( 'pwd_name' => $this->username ),
 375+ __METHOD__
 376+ );
 377+ // Put it into user_props as well for history
 378+ }
 379+
 380+ $insert = array();
 381+ foreach( $diff as $key => $value )
 382+ $insert[] = array(
 383+ 'up_timestamp' => $timestamp,
 384+ 'up_user' => $this->username,
 385+ 'up_name' => $key,
 386+ 'up_value' => $value,
 387+ );
 388+
 389+ $dbw->insert( 'user_props', $insert, __METHOD__ );
 390+ }
 391+}
Property changes on: branches/NssMySQLAuth-rewrite/NssMySQLAuth/SpecialAccountManager.php
___________________________________________________________________
Name: svn:eol-style
1392 + native

Status & tagging log