r97991 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97990‎ | r97991 | r97992 >
Date:11:46, 24 September 2011
Author:catrope
Status:ok
Tags:
Comment:
SpecialMoodBarFeedback: Make permalinks work
Modified paths:
  • /trunk/extensions/MoodBar/SpecialMoodBarFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/SpecialMoodBarFeedback.php
@@ -12,16 +12,21 @@
1313 public function execute( $par ) {
1414 global $wgOut, $wgRequest;
1515
16 - // Determine filters from the query string
17 - $filters = array();
18 - $type = $wgRequest->getArray( 'type' );
19 - if ( $type ) {
20 - $filters['type'] = $type;
 16+ $id = intval( $par );
 17+ if ( $id > 0 ) {
 18+ $filters = array( 'id' => $id );
 19+ } else {
 20+ // Determine filters from the query string
 21+ $filters = array();
 22+ $type = $wgRequest->getArray( 'type' );
 23+ if ( $type ) {
 24+ $filters['type'] = $type;
 25+ }
 26+ $username = strval( $wgRequest->getVal( 'username' ) );
 27+ if ( $username !== '' ) {
 28+ $filters['username'] = $username;
 29+ }
2130 }
22 - $username = strval( $wgRequest->getVal( 'username' ) );
23 - if ( $username !== '' ) {
24 - $filters['username'] = $username;
25 - }
2631 // Do the query
2732 $res = $this->doQuery( $filters );
2833
@@ -144,6 +149,9 @@
145150 $conds[] = 'mbf_user_ip IS NULL';
146151 }
147152 }
 153+ if ( isset( $filters['id'] ) ) {
 154+ $conds['mbf_id'] = $filters['id'];
 155+ }
148156
149157 $dbr = wfGetDB( DB_SLAVE );
150158 return $dbr->select( array( 'moodbar_feedback', 'user' ), array(

Status & tagging log