r86624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86623‎ | r86624 | r86625 >
Date:14:32, 21 April 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Copying EmailCapture extension to deployment branch
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/EmailCapture (added) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCapture.i18n.php
@@ -0,0 +1,254 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for EmailCapture extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Trevor Parscal
 14+ */
 15+$messages['en'] = array(
 16+ 'emailcapture' => 'E-mail address capture',
 17+ 'emailcapture-desc' => 'Capture e-mail addresses, and allow users to verify them through e-mail',
 18+ 'emailcapture-failure' => "Your e-mail was '''not''' verified.",
 19+ 'emailcapture-response-subject' => '{{SITENAME}} e-mail address verification',
 20+ 'emailcapture-response-body' => 'Verify your e-mail address by following this link:
 21+$1
 22+
 23+You can also visit:
 24+$2
 25+
 26+and enter the following verification code:
 27+$3
 28+
 29+Thank you for verifying your e-mail address.',
 30+ 'emailcapture-success' => 'Your e-mail address was successfully verified.',
 31+ 'emailcapture-instructions' => 'To verify your e-mail address, enter the code that was emailed to you and click "{{int:emailcapture-submit}}".',
 32+ 'emailcapture-verify' => 'Verification code:',
 33+ 'emailcapture-submit' => 'Verify e-mail address',
 34+);
 35+
 36+/** Message documentation (Message documentation)
 37+ * @author Kghbln
 38+ * @author Purodha
 39+ */
 40+$messages['qqq'] = array(
 41+ 'emailcapture-desc' => '{{desc}}',
 42+ 'emailcapture-instructions' => 'Used on [[Special:EmailCapture]], see image.
 43+[[Image:TestWiki-Special-EmailCapture-L4H0.png|Screenshot of Special:EmailCapture|right|thumb]]',
 44+ 'emailcapture-verify' => 'Used on [[Special:EmailCapture]], see image.
 45+[[Image:TestWiki-Special-EmailCapture-L4H0.png|Screenshot of Special:EmailCapture|right|thumb]]',
 46+ 'emailcapture-submit' => 'Used on [[Special:EmailCapture]], see image.
 47+[[Image:TestWiki-Special-EmailCapture-L4H0.png|Screenshot of Special:EmailCapture|right|thumb]]',
 48+);
 49+
 50+/** Belarusian (Taraškievica orthography) (‪Беларуская (тарашкевіца)‬)
 51+ * @author EugeneZelenko
 52+ * @author Jim-by
 53+ */
 54+$messages['be-tarask'] = array(
 55+ 'emailcapture' => 'Перахоп адрасу электроннай пошты',
 56+ 'emailcapture-desc' => 'Перахоплівае адрасы электроннай пошты, і дазваляе ўдзельнікам правяраць іх',
 57+ 'emailcapture-failure' => "Ваш адрас электроннай пошты '''ня''' быў правераны.",
 58+ 'emailcapture-response-subject' => 'Праверка адрасу электронную пошты для {{GRAMMAR:родны|{{SITENAME}}}}',
 59+ 'emailcapture-response-body' => 'Каб праверыць Ваш адрас электроннай пошты, перайдзіце па спасылцы:
 60+$1
 61+
 62+Так сама, Вы можаце наведаць:
 63+$2
 64+
 65+і увесьці наступны код праверкі:
 66+$3
 67+
 68+Дзякуй за праверку Вашага адрасу электроннай пошты.',
 69+ 'emailcapture-success' => 'Ваш адрас электроннай пошты быў правераны пасьпяхова.',
 70+ 'emailcapture-instructions' => 'Каб праверыць Ваш адрас электроннай пошты, увядзіце код, які быў Вам дасланы па электроннай пошце і націсьніце кнопку «{{int:emailcapture-submit}}».',
 71+ 'emailcapture-verify' => 'Код праверкі:',
 72+ 'emailcapture-submit' => 'Праверыць адрас электроннай пошты',
 73+);
 74+
 75+/** Breton (Brezhoneg)
 76+ * @author Fulup
 77+ */
 78+$messages['br'] = array(
 79+ 'emailcapture-failure' => "'''N'eo ket bet''' gwiriekaet ho chomlec'h postel.",
 80+ 'emailcapture-response-subject' => "Gwiriadenn chomlec'h postel evit {{SITENAME}}",
 81+ 'emailcapture-response-body' => "Gwiriit ho chomlec'h postel en ur heuliañ al liamm-mañ :
 82+$1
 83+
 84+Gallout a rit ivez mont da welet :
 85+$2
 86+
 87+ha merkañ ar c'hod gwiriekaat-mañ :
 88+$3
 89+
 90+Trugarez da lakaat gwiriekaat ho chomlec'h postel.",
 91+ 'emailcapture-success' => "Gwiriet eo bet ho chomlec'h postel ervat.",
 92+ 'emailcapture-instructions' => "Da wiriañ ho chomlec'h postel, merkit ar c'hod zo bet kaset deoc'h ha klikit war \"{{int:emailcapture-submit}}\".",
 93+ 'emailcapture-verify' => 'Kod gwiriekaat :',
 94+ 'emailcapture-submit' => "Gwiriekaat ar chomlec'h postel",
 95+);
 96+
 97+/** German (Deutsch)
 98+ * @author Kghbln
 99+ */
 100+$messages['de'] = array(
 101+ 'emailcapture' => 'E-Mail-Bestätigung',
 102+ 'emailcapture-desc' => 'Ermöglicht das automatische Aufgreifen von E-Mail-Adressen und deren Bestätigung durch deren Benutzer per E-Mail',
 103+ 'emailcapture-failure' => "Deine E-Mail-Adresse wurde '''nicht''' bestätigt.",
 104+ 'emailcapture-response-subject' => '{{SITENAME}} E-Mail-Bestätigung',
 105+ 'emailcapture-response-body' => 'Um deine E-Mail-Adresse zu bestätigen, klicke bitte auf den folgenden Link:
 106+$1
 107+
 108+Du kannst ebenso
 109+$2
 110+besuchen und den folgenden Bestätigungscode angeben:
 111+$3
 112+
 113+Vielen Dank für das Bestätigen deiner E-Mail-Adresse.',
 114+ 'emailcapture-success' => 'Deine E-Mail-Adresse wurde erfolgreich bestätigt.',
 115+ 'emailcapture-instructions' => 'Um deine E-Mail-Adresse zu bestätigen, gib bitte den Code ein, der dir per E-Mail zuschickt wurde und klicke anschließend auf „{{int:emailcapture-submit}}“.',
 116+ 'emailcapture-verify' => 'Bestätigungscode:',
 117+ 'emailcapture-submit' => 'E-Mail-Adresse bestätigen',
 118+);
 119+
 120+/** Interlingua (Interlingua)
 121+ * @author McDutchie
 122+ */
 123+$messages['ia'] = array(
 124+ 'emailcapture' => 'Captura de adresses de e-mail',
 125+ 'emailcapture-desc' => 'Capturar adresses de e-mail, e permitter al usatores de verificar los per e-mail',
 126+ 'emailcapture-failure' => "Tu adresse de e-mail '''non''' ha essite verificate.",
 127+ 'emailcapture-response-subject' => 'Verification del adresse de e-mail pro {{SITENAME}}',
 128+ 'emailcapture-response-body' => 'Pro verificar tu adresse de e-mail, seque iste ligamine:
 129+$1
 130+
 131+Alternativemente visita:
 132+$2
 133+
 134+e entra le codice de verification sequente:
 135+$3
 136+
 137+Gratias pro verificar tu adresse de e-mail.',
 138+ 'emailcapture-success' => 'Tu adresse de e-mail ha essite verificate con successo.',
 139+ 'emailcapture-instructions' => 'Pro verificar tu adresse de e-mail, entra le codice que te esseva inviate in e-mail, e clicca super "{{int:emailcapture-submit}}".',
 140+ 'emailcapture-verify' => 'Codice de verification:',
 141+ 'emailcapture-submit' => 'Verificar adresse de e-mail',
 142+);
 143+
 144+/** Colognian (Ripoarisch)
 145+ * @author Purodha
 146+ */
 147+$messages['ksh'] = array(
 148+ 'emailcapture' => 'Adräß för de <i lang="en">e-mail</i> schnappe',
 149+ 'emailcapture-desc' => 'Schnabb en Adräß för de <i lang="en">e-mail</i> un lohß de Metmaacher se övver en <i lang="en">e-mail</i> beschtäätejje.',
 150+ 'emailcapture-failure' => "Ding <i lang=\"en\">e-mail</i> wood '''nit''' beschtätesch",
 151+ 'emailcapture-response-subject' => '{{ucfirst:{{GRAMMAR:Genitiv ier feminine|{{SITENAME}}}}}} Beschtätejung för Adräße vun de <i lang="en">e-mail</i>',
 152+ 'emailcapture-response-body' => 'Öm Ding e-mail Adräß ze beschtääteje donn däm Lingk heh follje:
 153+$1
 154+
 155+Do kanns och op heh di Sigg jonn:
 156+$2
 157+
 158+un dann dä Kood heh enjävve:
 159+$3
 160+
 161+Mer bedangke uns för et Beschtäätejje.',
 162+ 'emailcapture-success' => 'Ding Adräß för de <i lang="en">e-mail</i> wood beschtäätesch.',
 163+ 'emailcapture-instructions' => 'Öm Ding Adräß för de <i lang="en">e-mail</i> ze bschtäätejje, donn onge dä Kood enjävve, dän De jescheck krääje häß, un donn dann op „{{int:emailcapture-submit}}“ klecke.',
 164+ 'emailcapture-verify' => 'Dä Kood för et Beschtäätejje:',
 165+ 'emailcapture-submit' => 'Lohß jonn!',
 166+);
 167+
 168+/** Luxembourgish (Lëtzebuergesch)
 169+ * @author Robby
 170+ */
 171+$messages['lb'] = array(
 172+ 'emailcapture-failure' => "Är E-Mail konnt '''net''' confirméiert ginn.",
 173+ 'emailcapture-submit' => 'E-Mail-Adress iwwerpréifen',
 174+);
 175+
 176+/** Macedonian (Македонски)
 177+ * @author Bjankuloski06
 178+ */
 179+$messages['mk'] = array(
 180+ 'emailcapture' => 'Потврда на е-пошта',
 181+ 'emailcapture-desc' => 'Заведување на е-поштенски адреси што корисниците можат да ги потврдат преку порака',
 182+ 'emailcapture-failure' => "Вашата е-пошта '''не''' е потврдена.",
 183+ 'emailcapture-response-subject' => '{{SITENAME}} — Потврда на е-пошта',
 184+ 'emailcapture-response-body' => 'За да ја потврдите вашата е-пошта, проследете ја следнава врска:
 185+ $1
 186+
 187+Или посетете ја страницава:
 188+ $2
 189+и внесете го следниов потврден код:
 190+ $3
 191+
 192+Ви благодариме што ја потврдивте вашата адреса.',
 193+ 'emailcapture-success' => 'Вашата е-пошта е успешно потврдена.',
 194+ 'emailcapture-instructions' => 'За да ја потврдите вашата е-пошта, внесете го кодот што ви го испративме и стиснете на „{{int:emailcapture-submit}}“.',
 195+ 'emailcapture-verify' => 'Потврден код:',
 196+ 'emailcapture-submit' => 'Потврди е-пошта',
 197+);
 198+
 199+/** Dutch (Nederlands)
 200+ * @author McDutchie
 201+ * @author Siebrand
 202+ */
 203+$messages['nl'] = array(
 204+ 'emailcapture' => 'E-mailadres bevestigen',
 205+ 'emailcapture-desc' => 'E-mailadressen bevestigen en stelt gebruikers in staat dit te doen via e-mail',
 206+ 'emailcapture-failure' => "Uw e-mailadres is '''niet''' bevestigd.",
 207+ 'emailcapture-response-subject' => 'E-mailadrescontrole van {{SITENAME}}',
 208+ 'emailcapture-response-body' => 'Volg deze verwijzing om uw e-mailadres te bevestigen:
 209+$1
 210+
 211+U kunt ook deze verwijzing volgen:
 212+$2
 213+
 214+en daar de volgende bevestigingscode invoeren:
 215+$3
 216+
 217+Dank u wel voor het bevestigen van uw e-mailadres.',
 218+ 'emailcapture-success' => 'Uw e-mailadres is bevestigd.',
 219+ 'emailcapture-instructions' => 'Voer de code uit uw e-mail in om uw e-mailadres te bevestigen en klik daarna op "{{int:emailcapture-submit}}".',
 220+ 'emailcapture-verify' => 'Bevestigingscode:',
 221+ 'emailcapture-submit' => 'E-mailadres bevestigen',
 222+);
 223+
 224+/** Telugu (తెలుగు)
 225+ * @author Veeven
 226+ */
 227+$messages['te'] = array(
 228+ 'emailcapture-response-subject' => '{{SITENAME}} ఈ-మెయిలు చిరునామా తనిఖీ',
 229+ 'emailcapture-success' => 'మీ ఈ-మెయిలు చిరునామాను విజయవంతంగా తనిఖీచేసాం.',
 230+ 'emailcapture-verify' => 'తనిఖీ సంకేతం:',
 231+);
 232+
 233+/** Tagalog (Tagalog)
 234+ * @author AnakngAraw
 235+ */
 236+$messages['tl'] = array(
 237+ 'emailcapture' => 'Pagdakip ng E-liham',
 238+ 'emailcapture-desc' => 'Hulihin ang mga tirahan ng e-liham, at payagan ang mga tagagamit na patunayan sila sa pamamagitan ng e-liham',
 239+ 'emailcapture-failure' => "'''Hindi''' pa napapatunayan ang e-liham mo.",
 240+ 'emailcapture-response-subject' => 'Pagpapatunay ng E-liham ng {{SITENAME}}',
 241+ 'emailcapture-response-body' => 'Upang mapatunayang ang tirahan mo ng e-liham, sundan ang kawing na ito:
 242+$1
 243+
 244+Maaari mo ring dalawin ang:
 245+$2
 246+at ipasok ang sumusundo na kodigo ng pagpapatunay:
 247+$3
 248+
 249+Salamat sa pagpapatotoo ng tirahan mo ng e-liham.',
 250+ 'emailcapture-success' => 'Matagumpay na napatunayan ang e-liham mo.',
 251+ 'emailcapture-instructions' => 'Upang mapatunayan ang tirahan mo ng e-liham, ipasok ang kodigong ipinadala sa iyo sa pamamagitan ng e-liham at pindutin ang "{{int:emailcapture-submit}}".',
 252+ 'emailcapture-verify' => 'Kodigo ng pagpapatotoo:',
 253+ 'emailcapture-submit' => 'Patunayan ang tirahan ng e-liham',
 254+);
 255+
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCapture.i18n.php
___________________________________________________________________
Added: svn:eol-style
1256 + native
Index: branches/wmf/1.17wmf1/extensions/EmailCapture/sql/CreateEmailCaptureTable.sql
@@ -0,0 +1,12 @@
 2+-- Captured email addresses
 3+CREATE TABLE IF NOT EXISTS /*_*/email_capture (
 4+ -- Email address
 5+ ec_email varbinary(255) PRIMARY KEY NOT NULL DEFAULT '',
 6+ -- Additional information
 7+ ec_info blob NOT NULL DEFAULT '',
 8+ -- Verification code
 9+ ec_code varbinary(32) NOT NULL DEFAULT '',
 10+ -- Verified
 11+ ec_verified boolean DEFAULT 0
 12+) /*$wgDBTableOptions*/;
 13+CREATE INDEX /*i*/ec_code_verified ON /*_*/email_capture (ec_code, ec_verified);
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/sql/CreateEmailCaptureTable.sql
___________________________________________________________________
Added: svn:eol-style
114 + native
Index: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCapture.php
@@ -0,0 +1,51 @@
 2+<?php
 3+/**
 4+ * EmailCapture extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ * @version 0.3.0
 9+ * @author Trevor Parscal <trevor@wikimedia.org>
 10+ * @license GPL v2 or later
 11+ * @link http://www.mediawiki.org/wiki/Extension:EmailCapture Documentation
 12+ */
 13+
 14+if ( !defined( 'MEDIAWIKI' ) ) {
 15+ die( "This is not a valid entry point to MediaWiki.\n" );
 16+}
 17+
 18+/* Configuration */
 19+$wgEmailCaptureSendAutoResponse = true;
 20+$wgEmailCaptureAutoResponse = array(
 21+ 'from' => $wgPasswordSender,
 22+ 'from-name' => $wgSitename,
 23+ 'subject-msg' => 'emailcapture-response-subject',
 24+ 'body-msg' => 'emailcapture-response-body',
 25+ 'reply-to' => null,
 26+ 'content-type' => null,
 27+);
 28+
 29+// Extension credits that will show up on Special:Version
 30+$wgExtensionCredits['other'][] = array(
 31+ 'path' => __FILE__,
 32+ 'name' => 'EmailCapture',
 33+ 'author' => 'Trevor Parscal',
 34+ 'version' => '0.3.0',
 35+ 'url' => 'http://www.mediawiki.org/wiki/Extension:EmailCapture',
 36+ 'descriptionmsg' => 'emailcapture-desc',
 37+);
 38+
 39+/* Setup */
 40+$dir = dirname( __FILE__ ) . '/';
 41+$wgExtensionMessagesFiles['EmailCapture'] = $dir . 'EmailCapture.i18n.php';
 42+$wgExtensionAliasesFiles['EmailCapture'] = $dir . 'EmailCapture.alias.php';
 43+// API
 44+$wgAutoloadClasses['ApiEmailCapture'] = $dir . 'api/ApiEmailCapture.php';
 45+$wgAPIModules['emailcapture'] = 'ApiEmailCapture';
 46+// Schema
 47+$wgAutoloadClasses['EmailCaptureHooks'] = $dir . 'EmailCaptureHooks.php';
 48+$wgHooks['LoadExtensionSchemaUpdates'][] = 'EmailCaptureHooks::loadExtensionSchemaUpdates';
 49+$wgHooks['ParserTestTables'][] = 'EmailCaptureHooks::parserTestTables';
 50+// Special page
 51+$wgAutoloadClasses['SpecialEmailCapture'] = $dir . 'SpecialEmailCapture.php';
 52+$wgSpecialPages['EmailCapture'] = 'SpecialEmailCapture';
\ No newline at end of file
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCapture.php
___________________________________________________________________
Added: svn:eol-style
153 + native
Index: branches/wmf/1.17wmf1/extensions/EmailCapture/SpecialEmailCapture.php
@@ -0,0 +1,46 @@
 2+<?php
 3+
 4+class SpecialEmailCapture extends SpecialPage {
 5+
 6+ public function __construct() {
 7+ parent::__construct( 'EmailCapture', 'emailcapture' );
 8+ }
 9+
 10+ public function execute( $par ) {
 11+ global $wgOut, $wgUser, $wgRequest;
 12+
 13+ $this->setHeaders();
 14+
 15+ $code = $wgRequest->getVal( 'verify' );
 16+ if ( $code !== null ) {
 17+ $dbw = wfGetDB( DB_MASTER );
 18+ $dbw->update(
 19+ 'email_capture',
 20+ array( 'ec_verified' => 1 ),
 21+ array( 'ec_code' => $code ),
 22+ __METHOD__
 23+ );
 24+ if ( $dbw->affectedRows() ) {
 25+ $wgOut->addWikiMsg( 'emailcapture-success' );
 26+ } else {
 27+ $wgOut->addWikiMsg( 'emailcapture-failure' );
 28+ }
 29+ } else {
 30+ // Show simple form for submitting verification code
 31+ $o = Html::openElement( 'form', array(
 32+ 'action' => $this->getTitle()->getFullUrl(),
 33+ 'method' => 'post'
 34+ ) );
 35+ $o .= Html::element( 'p', array(), wfMsg( 'emailcapture-instructions' ) );
 36+ $o .= Html::openElement( 'blockquote' );
 37+ $o .= Html::element( 'label', array( 'for' => 'emailcapture-verify' ),
 38+ wfMsg( 'emailcapture-verify' ) );
 39+ $o .= Html::input( 'verify', '', 'text',
 40+ array( 'id' => 'emailcapture-verify', 'size' => 32 ) );
 41+ $o .= Html::input( 'submit', wfMsg( 'emailcapture-submit' ), 'submit' );
 42+ $o .= Html::closeElement( 'blockquote' );
 43+ $o .= Html::closeElement( 'form' );
 44+ $wgOut->addHtml( $o );
 45+ }
 46+ }
 47+}
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/SpecialEmailCapture.php
___________________________________________________________________
Added: svn:eol-style
148 + native
Index: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCaptureHooks.php
@@ -0,0 +1,30 @@
 2+<?php
 3+/**
 4+ * Hooks for EmailCapture extension
 5+ */
 6+class EmailCaptureHooks {
 7+ /**
 8+ * LoadExtensionSchemaUpdates hook
 9+ */
 10+ public static function loadExtensionSchemaUpdates( $updater ) {
 11+ $db = $updater->getDB();
 12+ if ( !$db->tableExists( 'email_capture' ) ) {
 13+ // Initial install tables
 14+ $updater->addExtensionUpdate( array(
 15+ 'addTable',
 16+ 'email_capture',
 17+ dirname( __FILE__ ) . '/sql/CreateEmailCaptureTable.sql',
 18+ true
 19+ ) );
 20+ }
 21+ return true;
 22+ }
 23+
 24+ /**
 25+ * ParserTestTables hook
 26+ */
 27+ public static function parserTestTables( &$tables ) {
 28+ $tables[] = 'email_capture';
 29+ return true;
 30+ }
 31+}
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCaptureHooks.php
___________________________________________________________________
Added: svn:eol-style
132 + native
Index: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCapture.alias.php
@@ -0,0 +1,16 @@
 2+<?php
 3+/**
 4+ * Special page aliases for EmailCapture extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$specialPageAliases = array();
 11+
 12+/** English (English)
 13+ * @author Roan Kattouw
 14+ */
 15+$specialPageAliases['en'] = array(
 16+ 'EmailCapture' => array( 'EmailCapture' ),
 17+);
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/EmailCapture.alias.php
___________________________________________________________________
Added: svn:eol-style
118 + native
Index: branches/wmf/1.17wmf1/extensions/EmailCapture/api/ApiEmailCapture.php
@@ -0,0 +1,109 @@
 2+<?php
 3+
 4+class ApiEmailCapture extends ApiBase {
 5+ public function __construct( $query, $moduleName ) {
 6+ parent::__construct( $query, $moduleName, '' );
 7+ }
 8+
 9+ public function execute() {
 10+ $params = $this->extractRequestParams();
 11+
 12+ // Validation
 13+ if ( !User::isValidEmailAddr( $params['email'] ) ) {
 14+ $this->dieUsage( 'The email address does not appear to be valid', 'invalidemail' );
 15+ }
 16+
 17+ // Verification code
 18+ $code = md5( 'EmailCapture' . time() . $params['email'] . $params['info'] );
 19+
 20+ // Insert
 21+ $dbw = wfGetDB( DB_MASTER );
 22+ $dbw->insert(
 23+ 'email_capture',
 24+ array(
 25+ 'ec_email' => $params['email'],
 26+ 'ec_info' => isset( $params['info'] ) ? $params['info'] : null,
 27+ 'ec_code' => $code,
 28+ ),
 29+ __METHOD__,
 30+ array( 'IGNORE' )
 31+ );
 32+
 33+ if ( $dbw->affectedRows() ) {
 34+ // Send auto-response
 35+ global $wgUser, $wgEmailCaptureSendAutoResponse, $wgEmailCaptureAutoResponse;
 36+ $title = SpecialPage::getTitleFor( 'EmailCapture' );
 37+ $link = $title->getFullURL();
 38+ $fullLink = $title->getFullURL( array( 'verify' => $code ) );
 39+ if ( $wgEmailCaptureSendAutoResponse ) {
 40+ UserMailer::send(
 41+ new MailAddress( $params['email'] ),
 42+ new MailAddress(
 43+ $wgEmailCaptureAutoResponse['from'],
 44+ $wgEmailCaptureAutoResponse['from-name']
 45+ ),
 46+ wfMsg( $wgEmailCaptureAutoResponse['subject-msg'] ),
 47+ wfMsg( $wgEmailCaptureAutoResponse['body-msg'], $fullLink, $link, $code ),
 48+ $wgEmailCaptureAutoResponse['reply-to'],
 49+ $wgEmailCaptureAutoResponse['content-type']
 50+ );
 51+ }
 52+ $r = array( 'result' => 'Success' );
 53+ } else {
 54+ $r = array( 'result' => 'Failure', 'message' => 'Duplicate email address' );
 55+ }
 56+ $this->getResult()->addValue( null, $this->getModuleName(), $r );
 57+ }
 58+
 59+ public function getAllowedParams() {
 60+ return array(
 61+ 'email' => array(
 62+ ApiBase::PARAM_REQUIRED => true,
 63+ ApiBase::PARAM_TYPE => 'string',
 64+ ),
 65+ 'info' => array(
 66+ ApiBase::PARAM_TYPE => 'string',
 67+ ),
 68+ );
 69+ }
 70+
 71+ public function getParamDescription() {
 72+ return array(
 73+ 'email' => 'Email address to capture',
 74+ 'info' => 'Extra information to log, usually JSON encoded structured information',
 75+ );
 76+ }
 77+
 78+ public function getDescription() {
 79+ return array(
 80+ 'Capture email addresses'
 81+ );
 82+ }
 83+
 84+ public function mustBePosted() {
 85+ return true;
 86+ }
 87+
 88+ public function isWriteMode() {
 89+ return true;
 90+ }
 91+
 92+ public function getPossibleErrors() {
 93+ return array_merge( parent::getPossibleErrors(), array(
 94+ array(
 95+ 'code' => 'invalidemail',
 96+ 'info' => 'The email address does not appear to be valid'
 97+ ),
 98+ ) );
 99+ }
 100+
 101+ protected function getExamples() {
 102+ return array(
 103+ 'api.php?action=emailcapture'
 104+ );
 105+ }
 106+
 107+ public function getVersion() {
 108+ return __CLASS__ . ': $Id$';
 109+ }
 110+}
Property changes on: branches/wmf/1.17wmf1/extensions/EmailCapture/api/ApiEmailCapture.php
___________________________________________________________________
Added: svn:keywords
1111 + Id
Added: svn:eol-style
2112 + native

Status & tagging log