r100904 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100903‎ | r100904 | r100905 >
Date:23:24, 26 October 2011
Author:werdna
Status:ok
Tags:
Comment:
MoodBar: Hide hidden results from non-admin users
Modified paths:
  • /trunk/extensions/MoodBar/ApiQueryMoodBarComments.php (modified) (history)
  • /trunk/extensions/MoodBar/SpecialFeedbackDashboard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/ApiQueryMoodBarComments.php
@@ -6,7 +6,7 @@
77 }
88
99 public function execute() {
10 - global $wgLang;
 10+ global $wgLang, $wgUser;
1111 $params = $this->extractRequestParams();
1212 $prop = array_flip( $params['prop'] );
1313
@@ -38,6 +38,10 @@
3939 $this->addWhereRange( 'mbf_id', $params['dir'], null, null );
4040 $this->addOption( 'LIMIT', $params['limit'] + 1 );
4141
 42+ if ( ! $wgUser->isAllowed( 'moodbar-admin' ) ) {
 43+ $this->addWhereFld( 'mbf_hidden_state', 0 );
 44+ }
 45+
4246 $res = $this->select( __METHOD__ );
4347 $result = $this->getResult();
4448 $count = 0;
Index: trunk/extensions/MoodBar/SpecialFeedbackDashboard.php
@@ -392,6 +392,8 @@
393393 * @return array( 'rows' => array( row, row, ... ), 'olderRow' => row|null, 'newerRow' => row|null )
394394 */
395395 public function doQuery( $filters, $limit, $offset, $backwards ) {
 396+ global $wgUser;
 397+
396398 $dbr = wfGetDB( DB_SLAVE );
397399
398400 // Set $conds based on $filters
@@ -411,6 +413,8 @@
412414 }
413415 if ( isset( $filters['id'] ) ) {
414416 $conds['mbf_id'] = $filters['id'];
 417+ } elseif ( !$wgUser->isAllowed('moodbar-admin') ) {
 418+ $conds['mbf_hidden_state'] = 0;
415419 }
416420
417421 // Process $offset

Status & tagging log