Index: trunk/extensions/MoodBar/MoodBar.hooks.php |
— | — | @@ -28,25 +28,23 @@ |
29 | 29 | */ |
30 | 30 | public static function onMarkItemAsHelpful( $mahaction, $type, $item, $User, &$isAbleToMark ) { |
31 | 31 | |
| 32 | + if ( $User->isAnon() ) { |
| 33 | + $isAbleToMark = false; |
| 34 | + return true; |
| 35 | + } |
| 36 | + |
32 | 37 | if ( $type == 'mbresponse' ) { |
33 | 38 | |
34 | 39 | switch ( $mahaction ) { |
35 | 40 | |
36 | 41 | case 'mark': |
37 | 42 | $dbr = wfGetDB( DB_SLAVE ); |
38 | | - |
39 | | - $conds = array( 'mbf_id = mbfr_mbf_id', 'mbfr_id' => intval( $item ) ); |
40 | | - |
41 | | - if ( !$User->isAnon() ) { |
42 | | - $conds['mbf_user_id'] = $User->getId(); |
43 | | - } |
44 | | - else { |
45 | | - $conds['mbf_user_ip'] = $User->getName(); |
46 | | - } |
47 | | - |
| 43 | + |
48 | 44 | $res = $dbr->selectRow( array( 'moodbar_feedback', 'moodbar_feedback_response' ), |
49 | 45 | array( 'mbf_id' ), |
50 | | - $conds, |
| 46 | + array( 'mbf_id = mbfr_mbf_id', |
| 47 | + 'mbfr_id' => intval( $item ), |
| 48 | + 'mbf_user_id' => $User->getId() ), |
51 | 49 | __METHOD__ ); |
52 | 50 | |
53 | 51 | if ( $res === false ) { |