Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -693,7 +693,7 @@ |
694 | 694 | if( $wgUser->isAllowed( 'feedback' ) ) { |
695 | 695 | # If the user already voted, then don't show the form. |
696 | 696 | # Always show for IPs however, due to squid caching... |
697 | | - if( !$wgUser->getId() || !FlaggedRevs::userAlreadyVoted( $this->parent->getTitle() ) ) { |
| 697 | + if( !$wgUser->getId() || !FlaggedRevs::userAlreadyVoted( $wgUser, $this->parent->getTitle() ) ) { |
698 | 698 | $this->addQuickFeedback( $data ); |
699 | 699 | } |
700 | 700 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -953,18 +953,18 @@ |
954 | 954 | return ( $dbw->affectedRows() > 0 ); |
955 | 955 | } |
956 | 956 | |
957 | | - public static function userAlreadyVoted( $title ) { |
958 | | - global $wgUser; |
| 957 | + public static function userAlreadyVoted( $user, $title ) { |
959 | 958 | $dbw = wfGetDB( DB_MASTER ); |
960 | | - # Check if user already voted before... |
961 | | - if( $wgUser->getId() ) { |
| 959 | + $userVoted = false; |
| 960 | + if( $user->getId() ) { |
962 | 961 | $userVoted = $dbw->selectField( array('reader_feedback','page'), '1', |
963 | 962 | array( 'page_namespace' => $title->getNamespace(), |
964 | 963 | 'page_title' => $title->getDBKey(), |
965 | 964 | 'rfb_rev_id = page_latest', |
966 | | - 'rfb_user' => $wgUser->getId() ), |
| 965 | + 'rfb_user' => $user->getId() ), |
967 | 966 | __METHOD__ ); |
968 | | - } else { |
| 967 | + } |
| 968 | + if( !$userVoted ) { |
969 | 969 | $userVoted = $dbw->selectField( array('reader_feedback','page'), '1', |
970 | 970 | array( 'page_namespace' => $title->getNamespace(), |
971 | 971 | 'page_title' => $title->getDBKey(), |
Index: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php |
— | — | @@ -54,8 +54,8 @@ |
55 | 55 | } |
56 | 56 | |
57 | 57 | protected function showHeader() { |
58 | | - global $wgOut; |
59 | | - if( FlaggedRevs::userAlreadyVoted( $this->page ) ) { |
| 58 | + global $wgOut, $wgUser; |
| 59 | + if( FlaggedRevs::userAlreadyVoted( $wgUser, $this->page ) ) { |
60 | 60 | $wgOut->addWikiText( wfMsg('ratinghistory-thanks') . '<hr/>' ); |
61 | 61 | } |
62 | 62 | $wgOut->addWikiText( wfMsg('ratinghistory-text',$this->page->getPrefixedText()) ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -388,8 +388,7 @@ |
389 | 389 | $sha1 = ""; |
390 | 390 | global $wgUseStableImages; |
391 | 391 | if( $wgUseStableImages && FlaggedRevs::isPageReviewable( $title ) ) { |
392 | | - $srev = FlaggedRevision::newFromStable( $title ); |
393 | | - if( $srev ) { |
| 392 | + if( $srev = FlaggedRevision::newFromStable( $title ) ) { |
394 | 393 | $time = $srev->getFileTimestamp(); |
395 | 394 | $sha1 = $srev->getFileSha1(); |
396 | 395 | } |
— | — | @@ -405,7 +404,7 @@ |
406 | 405 | } |
407 | 406 | # If there is no stable version (or that feature is not enabled), use |
408 | 407 | # the image revision during review time. If both, use the newest one. |
409 | | - if( !FlaggedRevs::useProcessCache( $parser->getRevisionId() ) && $time === false ) { |
| 408 | + if( !FlaggedRevs::useProcessCache( $parser->getRevisionId() ) ) { |
410 | 409 | $row = $dbr->selectRow( 'flaggedimages', |
411 | 410 | array( 'fi_img_timestamp', 'fi_img_sha1' ), |
412 | 411 | array( 'fi_rev_id' => $parser->getRevisionId(), |
— | — | @@ -457,8 +456,7 @@ |
458 | 457 | $sha1 = ""; |
459 | 458 | global $wgUseStableImages; |
460 | 459 | if( $wgUseStableImages && FlaggedRevs::isPageReviewable( $nt ) ) { |
461 | | - $srev = FlaggedRevision::newFromStable( $nt ); |
462 | | - if( $srev ) { |
| 460 | + if( $srev = FlaggedRevision::newFromStable( $nt ) ) { |
463 | 461 | $time = $srev->getFileTimestamp(); |
464 | 462 | $sha1 = $srev->getFileSha1(); |
465 | 463 | } |
— | — | @@ -474,7 +472,7 @@ |
475 | 473 | } |
476 | 474 | # If there is no stable version (or that feature is not enabled), use |
477 | 475 | # the image revision during review time. If both, use the newest one. |
478 | | - if( !FlaggedRevs::useProcessCache( $ig->mRevisionId ) && $time === false ) { |
| 476 | + if( !FlaggedRevs::useProcessCache( $ig->mRevisionId ) ) { |
479 | 477 | $row = $dbr->selectRow( 'flaggedimages', |
480 | 478 | array( 'fi_img_timestamp', 'fi_img_sha1' ), |
481 | 479 | array('fi_rev_id' => $ig->mRevisionId, |
— | — | @@ -1092,7 +1090,6 @@ |
1093 | 1091 | $fa = FlaggedArticle::getTitleInstance( $skintemplate->mTitle ); |
1094 | 1092 | # Add rating tab |
1095 | 1093 | if( $fa->isRateable() ) { |
1096 | | - wfLoadExtensionMessages( 'FlaggedRevs' ); |
1097 | 1094 | wfLoadExtensionMessages( 'RatingHistory' ); |
1098 | 1095 | $nav_urls['ratinghist'] = array( |
1099 | 1096 | 'text' => wfMsg( 'ratinghistory-link' ), |