r95976 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95975‎ | r95976 | r95977 >
Date:13:04, 1 September 2011
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
use id and name in token salt; bug 30644
Modified paths:
  • /trunk/extensions/UploadWizard/includes/specials/SpecialUploadCampaigns.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadCampaigns.php
@@ -57,7 +57,7 @@
5858
5959 $this->setHeaders();
6060 $this->outputHeader();
61 - $subPage = explode( '/', $subPage, 2 );
 61+ $subPage = explode( '/', $subPage, 4 );
6262
6363 // If the user is authorized, display the page, if not, show an error.
6464 if ( $this->userCanExecute( $wgUser ) ) {
@@ -66,9 +66,9 @@
6767 && $wgRequest->getCheck( 'newcampaign' ) ) {
6868 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'UploadCampaign', $wgRequest->getVal( 'newcampaign' ) )->getLocalURL() );
6969 }
70 - elseif ( count( $subPage ) == 2 && $subPage[0] == 'del'
71 - && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
72 - $campaign = UploadWizardCampaign::newFromName( $subPage[1], false );
 70+ elseif ( count( $subPage ) == 4 && $subPage[0] == 'del'
 71+ && $wgUser->matchEditToken( $subPage[3], serialize( array( $subPage[1], $subPage[2] ) ) ) ) {
 72+ $campaign = UploadWizardCampaign::newFromId( $subPage[1], false );
7373 $campaign->deleteFromDB();
7474 $this->getOutput()->redirect( $this->getTitle()->getLocalURL() );
7575 }
@@ -173,9 +173,13 @@
174174 $out->addHTML( '<tbody>' );
175175
176176 global $wgUser;
177 - $editToken = array( 'wpEditToken' => $wgUser->editToken() );
178177
179178 foreach ( $campaigns as $campaign ) {
 179+ $editToken = $wgUser->editToken( serialize( array(
 180+ $campaign->campaign_id,
 181+ $campaign->campaign_name
 182+ ) ) );
 183+
180184 $out->addHTML(
181185 '<tr>' .
182186 '<td>' .
@@ -201,7 +205,10 @@
202206 Html::element(
203207 'a',
204208 array(
205 - 'href' => SpecialPage::getTitleFor( 'UploadCampaigns', 'del/' . $campaign->campaign_name )->getLocalURL( $editToken ),
 209+ 'href' => SpecialPage::getTitleFor(
 210+ 'UploadCampaigns',
 211+ implode( '/', array( 'del', $campaign->campaign_id, $campaign->campaign_name, $editToken ) )
 212+ )->getLocalURL(),
206213 'onclick' => 'return confirm( "' . wfMsg( 'mwe-upwiz-campaigns-confdel' ) . '" )'
207214 ),
208215 wfMsg( 'mwe-upwiz-campaigns-delete' )

Follow-up revisions

RevisionCommit summaryAuthorDate
r96018follow up to r95976jeroendedauw18:00, 1 September 2011
r96575fix bug 30644jeroendedauw15:15, 8 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95880address bug 30644jeroendedauw16:14, 31 August 2011

Comments

#Comment by Nikerabbit (talk | contribs)   14:44, 1 September 2011

No $this->getTitle()?

#Comment by NeilK (talk | contribs)   18:34, 12 September 2011

$this->getTitle() issue resolved in followup commits... looks okay to me

Status & tagging log