Index: trunk/extensions/Vote/Vote.php |
— | — | @@ -57,5 +57,4 @@ |
58 | 58 | } else { |
59 | 59 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
60 | 60 | exit( 1 ) ; |
61 | | -} |
62 | | - |
| 61 | +} |
\ No newline at end of file |
Index: trunk/extensions/Vote/Vote.css |
— | — | @@ -1,12 +1,11 @@ |
2 | 2 | /** |
3 | 3 | * CSS file for the Vote extension |
4 | 4 | * |
5 | | - * @package MediaWiki |
6 | | - * @subpackage Extensions |
| 5 | + * @addtogroup Extensions |
7 | 6 | * @author Rob Church <robchur@gmail.com> |
| 7 | + * |
8 | 8 | * Please see the LICENCE file for terms of use and redistribution |
9 | 9 | */ |
10 | | - |
11 | 10 | table.mw-votedata td, th { |
12 | 11 | padding: 2px; |
13 | 12 | } |
Index: trunk/extensions/Vote/vote.sql |
— | — | @@ -1,3 +1,4 @@ |
| 2 | +-- Table for the Vote extension; holds individual votes |
2 | 3 | CREATE TABLE /*wgDBprefix*/vote ( |
3 | 4 | vote_id int(11) NOT NULL auto_increment, |
4 | 5 | vote_user int(11) NOT NULL, |
Index: trunk/extensions/Vote/Vote.page.php |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | * |
7 | 7 | * @addtogroup Extensions |
8 | 8 | * @author Rob Church <robchur@gmail.com> |
| 9 | + * |
9 | 10 | * Please see the LICENCE file for terms of use and redistribution |
10 | 11 | */ |
11 | 12 | |
— | — | @@ -19,13 +20,13 @@ |
20 | 21 | public function execute( $mode = false ) { |
21 | 22 | global $wgOut, $wgUser; |
22 | 23 | $this->setHeaders(); |
23 | | - $this->user =& $wgUser; |
| 24 | + $this->user = $wgUser; |
24 | 25 | if( strtolower( $mode ) == 'results' ) { |
25 | 26 | if( $wgUser->isAllowed( 'voteadmin' ) ) |
26 | 27 | $this->showResults(); |
27 | 28 | } else { |
28 | 29 | if( $wgUser->isAnon() ) { |
29 | | - $skin =& $wgUser->getSkin(); |
| 30 | + $skin = $wgUser->getSkin(); |
30 | 31 | $self = SpecialPage::getTitleFor( 'Vote' ); |
31 | 32 | $login = SpecialPage::getTitleFor( 'Userlogin' ); |
32 | 33 | $link = $skin->makeKnownLinkObj( $login, wfMsgHtml( 'vote-login-link' ), 'returnto=' . $self->getPrefixedUrl() ); |
— | — | @@ -45,7 +46,7 @@ |
46 | 47 | $self = SpecialPage::getTitleFor( 'Vote' ); |
47 | 48 | $token = $wgRequest->getText( 'token' ); |
48 | 49 | if( $wgUser->isAllowed( 'voteadmin' ) ) { |
49 | | - $skin =& $wgUser->getSkin(); |
| 50 | + $skin = $wgUser->getSkin(); |
50 | 51 | $rtitle = Title::makeTitle( NS_SPECIAL, $self->getText() . '/results' ); |
51 | 52 | $rlink = $skin->makeKnownLinkObj( $rtitle, wfMsgHtml( 'vote-view-results' ) ); |
52 | 53 | $wgOut->addHtml( '<p class="mw-voteresultslink">' . $rlink . '</p>' ); |
— | — | @@ -69,14 +70,14 @@ |
70 | 71 | } |
71 | 72 | } |
72 | 73 | |
73 | | - private static function getExistingVote( &$user ) { |
74 | | - $dbr =& wfGetDB( DB_SLAVE ); |
| 74 | + private static function getExistingVote( $user ) { |
| 75 | + $dbr = wfGetDB( DB_SLAVE ); |
75 | 76 | $choice = $dbr->selectField( 'vote', 'vote_choice', array( 'vote_user' => $user->getId() ), __METHOD__ ); |
76 | 77 | return $choice; |
77 | 78 | } |
78 | 79 | |
79 | | - private static function updateVote( &$user, $choice ) { |
80 | | - $dbw =& wfGetDB( DB_MASTER ); |
| 80 | + private static function updateVote( $user, $choice ) { |
| 81 | + $dbw = wfGetDB( DB_MASTER ); |
81 | 82 | $dbw->begin(); |
82 | 83 | $dbw->delete( 'vote', array( 'vote_user' => $user->getId() ), __METHOD__ ); |
83 | 84 | $dbw->insert( 'vote', array( 'vote_user' => $user->getId(), 'vote_choice' => $choice ), __METHOD__ ); |
— | — | @@ -86,7 +87,7 @@ |
87 | 88 | private function showResults() { |
88 | 89 | global $wgOut, $wgLang; |
89 | 90 | $wgOut->setPageTitle( wfMsg( 'vote-results' ) ); |
90 | | - $dbr =& wfGetDB( DB_SLAVE ); |
| 91 | + $dbr = wfGetDB( DB_SLAVE ); |
91 | 92 | $vote = $dbr->tableName( 'vote' ); |
92 | 93 | $res = $dbr->query( "SELECT vote_choice, COUNT(*) as count FROM {$vote} GROUP BY vote_choice ORDER BY count DESC", __METHOD__ ); |
93 | 94 | if( $res && $dbr->numRows( $res ) > 0 ) { |
— | — | @@ -147,5 +148,4 @@ |
148 | 149 | return Xml::openElement( 'option', $attribs ) . htmlspecialchars( $label ) . Xml::closeElement( 'option' ); |
149 | 150 | } |
150 | 151 | |
151 | | -} |
152 | | - |
| 152 | +} |
\ No newline at end of file |