Index: trunk/extensions/EmailCapture/EmailCapture.i18n.php |
— | — | @@ -26,4 +26,7 @@ |
27 | 27 | |
28 | 28 | Thank you for verifying your email address.', |
29 | 29 | 'emailcapture-success' => 'Your email was successfully verified.', |
| 30 | + 'emailcapture-instructions' => 'To verify your email address, enter the code that was emailed to you and click verify.', |
| 31 | + 'emailcapture-verify' => 'Verification code:', |
| 32 | + 'emailcapture-submit' => 'Verify email address', |
30 | 33 | ); |
Index: trunk/extensions/EmailCapture/SpecialEmailCapture.php |
— | — | @@ -7,26 +7,40 @@ |
8 | 8 | } |
9 | 9 | |
10 | 10 | public function execute( $par ) { |
11 | | - global $wgOut, $wgRequest; |
| 11 | + global $wgOut, $wgUser, $wgRequest; |
12 | 12 | |
13 | 13 | $this->setHeaders(); |
14 | 14 | |
15 | 15 | $code = $wgRequest->getVal( 'verify' ); |
16 | | - if ( $verify !== null ) { |
| 16 | + if ( $code !== null ) { |
17 | 17 | $dbw = wfGetDB( DB_MASTER ); |
18 | | - $affectedRows = $dbw->update( |
| 18 | + $dbw->update( |
19 | 19 | 'email_capture', |
20 | 20 | array( 'ec_verified' => 1 ), |
21 | 21 | array( 'ec_code' => $code ), |
22 | 22 | __METHOD__ |
23 | 23 | ); |
24 | | - if ( $affectedRows ) { |
| 24 | + if ( $dbw->affectedRows() ) { |
25 | 25 | $wgOut->addWikiMsg( 'emailcapture-success' ); |
26 | 26 | } else { |
27 | 27 | $wgOut->addWikiMsg( 'emailcapture-failure' ); |
28 | 28 | } |
29 | | - // exit |
| 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 ); |
30 | 45 | } |
31 | | - // Show simple form for submitting verification code |
32 | 46 | } |
33 | 47 | } |
Index: trunk/extensions/EmailCapture/EmailCaptureHooks.php |
— | — | @@ -6,16 +6,16 @@ |
7 | 7 | /** |
8 | 8 | * LoadExtensionSchemaUpdates hook |
9 | 9 | */ |
10 | | - public static function loadExtensionSchemaUpdates( $updater = null ) { |
11 | | - $dir = dirname( __FILE__ ); |
| 10 | + public static function loadExtensionSchemaUpdates( $updater ) { |
12 | 11 | $db = $updater->getDB(); |
13 | 12 | if ( !$db->tableExists( 'email_capture' ) ) { |
14 | 13 | // Initial install tables |
15 | 14 | $updater->addExtensionUpdate( array( |
16 | 15 | 'addTable', |
17 | 16 | 'email_capture', |
18 | | - dirname( __FILE__ ) . '/sql/CreateEmailCaptureTable.sql' |
19 | | - ); |
| 17 | + dirname( __FILE__ ) . '/sql/CreateEmailCaptureTable.sql', |
| 18 | + true |
| 19 | + ) ); |
20 | 20 | } |
21 | 21 | return true; |
22 | 22 | } |