Index: trunk/extensions/LiquidThreads/classes/LqtView.php |
— | — | @@ -373,7 +373,24 @@ |
374 | 374 | $e->suppressIntro = true; |
375 | 375 | $e->editFormTextBeforeContent .= |
376 | 376 | $this->perpetuate( 'lqt_method', 'hidden' ) . |
377 | | - $this->perpetuate( 'lqt_operand', 'hidden' ); |
| 377 | + $this->perpetuate( 'lqt_operand', 'hidden' ) . |
| 378 | + Xml::hidden( 'lqt_nonce', wfGenerateToken() ); |
| 379 | + |
| 380 | + // Add a one-time random string to a hidden field. Store the random string |
| 381 | + // in memcached on submit and don't allow the edit to go ahead if it's already |
| 382 | + // been added. |
| 383 | + $submitted_nonce = $this->request->getVal( 'lqt_nonce' ); |
| 384 | + if ($submitted_nonce) { |
| 385 | + global $wgMemc; |
| 386 | + |
| 387 | + $key = wfMemcKey( 'lqt-nonce', $submitted_nonce, $this->user->getName() ); |
| 388 | + if ( $wgMemc->get($key) ) { |
| 389 | + $this->output->redirect( $this->article->getTitle()->getFullURL() ); |
| 390 | + return; |
| 391 | + } |
| 392 | + |
| 393 | + $wgMemc->set( $key, 1, 3600 ); |
| 394 | + } |
378 | 395 | |
379 | 396 | if ( $edit_type == 'new' || ( $thread && !$thread->hasSuperthread() ) ) { |
380 | 397 | wfLoadExtensionMessages( 'LiquidThreads' ); |