Index: trunk/extensions/BoardVote/BoardVote_body.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | } |
13 | 13 | |
14 | 14 | class BoardVotePage extends SpecialPage { |
15 | | - var $mPosted, $mVotedFor, $mDBname, $mUserDays, $mUserEdits; |
| 15 | + var $mPosted, $mVotedFor, $mUserDays, $mUserEdits; |
16 | 16 | var $mHasVoted, $mAction, $mUserKey, $mId, $mFinished; |
17 | 17 | var $mDb; |
18 | 18 | |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | } |
22 | 22 | |
23 | 23 | function execute( $par ) { |
24 | | - global $wgUser, $wgDBname, $wgInputEncoding, $wgRequest, $wgBoardVoteDB, |
| 24 | + global $wgUser, $wgDBname, $wgInputEncoding, $wgRequest, |
25 | 25 | $wgBoardVoteEditCount, $wgBoardVoteEndDate; |
26 | 26 | |
27 | 27 | $this->mUserKey = iconv( $wgInputEncoding, "UTF-8", $wgUser->getName() ) . "@$wgDBname"; |
— | — | @@ -32,7 +32,6 @@ |
33 | 33 | } |
34 | 34 | $this->mId = $wgRequest->getInt( "id", 0 ); |
35 | 35 | |
36 | | - $this->mDBname = $wgBoardVoteDB; |
37 | 36 | $this->mHasVoted = $this->hasVoted( $wgUser ); |
38 | 37 | |
39 | 38 | if ( $par ) { |
— | — | @@ -88,15 +87,21 @@ |
89 | 88 | |
90 | 89 | function getDB() { |
91 | 90 | if ( !$this->mDb ) { |
92 | | - $this->mDb = wfGetDB( DB_MASTER, 'boardvote' ); |
| 91 | + global $wgBoardVoteDBServer, $wgBoardVoteDB, $wgDBuser, $wgDBpassword; |
| 92 | + |
| 93 | + $this->mDb = new Database( $wgBoardVoteDBServer, $wgDBuser, $wgDBpassword, |
| 94 | + $wgBoardVoteDB, /*failfn*/false, /*flags*/0, /*prefix*/'' ); |
| 95 | + if ( !$this->mDb->isOpen() ) { |
| 96 | + // This should be handled inside the constructor, but we'll check just in case |
| 97 | + throw new MWException( "DB connection failed unexpectedly" ); |
| 98 | + } |
93 | 99 | } |
94 | 100 | return $this->mDb; |
95 | 101 | } |
96 | 102 | |
97 | 103 | function hasVoted( &$user ) { |
98 | | - global $wgDBname; |
99 | 104 | $dbr =& $this->getDB(); |
100 | | - $row = $dbr->selectRow( "`{$this->mDBname}`.log", array( "1" ), |
| 105 | + $row = $dbr->selectRow( 'log', array( "1" ), |
101 | 106 | array( "log_user_key" => $this->mUserKey ), "BoardVotePage::getUserVote" ); |
102 | 107 | if ( $row === false ) { |
103 | 108 | return false; |
— | — | @@ -114,7 +119,7 @@ |
115 | 120 | $encrypted = $this->encrypt( $record ); |
116 | 121 | $gpgKey = file_get_contents( $wgGPGPubKey ); |
117 | 122 | $dbw =& $this->getDB(); |
118 | | - $log = $dbw->tableName( "`{$this->mDBname}`.log" ); |
| 123 | + $log = $dbw->tableName( "log" ); |
119 | 124 | |
120 | 125 | # Mark previous votes as old |
121 | 126 | $encKey = $dbw->strencode( $this->mUserKey ); |
— | — | @@ -286,7 +291,7 @@ |
287 | 292 | $userRights = $wgUser->getRights(); |
288 | 293 | $admin = $this->isAdmin(); |
289 | 294 | $dbr =& $this->getDB(); |
290 | | - $log = $dbr->tableName( "`{$this->mDBname}`.log" ); |
| 295 | + $log = $dbr->tableName( "log" ); |
291 | 296 | |
292 | 297 | $sql = "SELECT * FROM $log ORDER BY log_user_key"; |
293 | 298 | $res = $dbr->query( $sql, "BoardVotePage::list" ); |
— | — | @@ -377,7 +382,7 @@ |
378 | 383 | function dump() { |
379 | 384 | global $wgOut, $wgOutputEncoding, $wgLang, $wgUser; |
380 | 385 | $dbr =& $this->getDB(); |
381 | | - $log = $dbr->tableName( "`{$this->mDBname}`.log" ); |
| 386 | + $log = $dbr->tableName( "log" ); |
382 | 387 | |
383 | 388 | $sql = "SELECT log_record FROM $log WHERE log_current=1 AND log_strike=0"; |
384 | 389 | $res = $dbr->query( $sql, DB_SLAVE, "BoardVotePage::list" ); |
— | — | @@ -408,7 +413,7 @@ |
409 | 414 | global $wgOut; |
410 | 415 | |
411 | 416 | $dbw =& $this->getDB(); |
412 | | - $log = $dbw->tableName( "`{$this->mDBname}`.log" ); |
| 417 | + $log = $dbw->tableName( "log" ); |
413 | 418 | |
414 | 419 | if ( !$this->isAdmin() ) { |
415 | 420 | $wgOut->addWikiText( wfMsg( "boardvote_needadmin" ) ); |
Index: trunk/extensions/BoardVote/BoardVote.i18n.php |
— | — | @@ -31,8 +31,8 @@ |
32 | 32 | position. In the event of a tie, a run-off election will be held.</p> |
33 | 33 | |
34 | 34 | <p>For more information, see:</p> |
35 | | -<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2005\" class=\"external\">Election FAQ</a></li> |
36 | | -<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2005\" class=\"external\">Candidates</a></li></ul> |
| 35 | +<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2006\" class=\"external\">Election FAQ</a></li> |
| 36 | +<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2006\" class=\"external\">Candidates</a></li></ul> |
37 | 37 | ", |
38 | 38 | 'boardvote_intro_change' => "<p>You have voted before. However you may change |
39 | 39 | your vote using the form below. Please check the boxes next to each candidate whom |
— | — | @@ -53,10 +53,8 @@ |
54 | 54 | <pre>$3</pre> |
55 | 55 | |
56 | 56 | [[Special:Boardvote/entry|Back]]", |
57 | | - 'boardvote_notloggedin' => "You are not logged in. To vote, you must use an account |
58 | | -with at least $1 contributions before $2.", |
59 | | - 'boardvote_notqualified' => "Sorry, you made only $1 edits before $2. You |
60 | | -need at least $3 to be able to vote.", |
| 57 | + 'boardvote_notloggedin' => "You are not logged in. To vote, you must use an account with at least $1 contributions before $2, and with a first edit before $3.", |
| 58 | + 'boardvote_notqualified' => "You are not qualified to vote in this election. You need to have made $3 edits before $2, you have made $1. Also, your first edit was at $4, it needs to be before $5. ", |
61 | 59 | 'boardvote_novotes' => "Nobody has voted yet.", |
62 | 60 | 'boardvote_time' => "Time", |
63 | 61 | 'boardvote_user' => "User", |
— | — | @@ -71,7 +69,7 @@ |
72 | 70 | 'boardvote_unstrike' => "Unstrike", |
73 | 71 | 'boardvote_needadmin' => "Only election administrators can perform this operation.", |
74 | 72 | 'boardvote_sitenotice' => "<a href=\"{{localurle:Special:Boardvote/vote}}\">Wikimedia Board Elections</a>: Vote open until July 12", |
75 | | - 'boardvote_closed' => 'Voting is now closed, see [http://meta.wikimedia.org/wiki/Elections_for_the_Board_of_Trustees_of_the_Wikimedia_Foundation%2C_2005/En the elections page for results] soon.', |
| 73 | + 'boardvote_closed' => 'Voting is now closed, see [http://meta.wikimedia.org/wiki/Elections_for_the_Board_of_Trustees_of_the_Wikimedia_Foundation%2C_2006/En the elections page for results] soon.', |
76 | 74 | 'boardvote_edits_many' => 'many', |
77 | 75 | 'group-boardvote' => 'Board vote admins', |
78 | 76 | 'group-boardvote-member' => 'Board vote admin', |
— | — | @@ -90,8 +88,8 @@ |
91 | 89 | <p>באפשרותכם להצביע עבור מספר מועמדים. המועמדים עם מירב ההצבעות בכל עמדה יוכרזו כמנצחים בעמדה זו. במידה ויתקיים שיוויון בין מספר מועמדים, תתבצע הצבעה נוספת ביניהם.</p> |
92 | 90 | |
93 | 91 | <p>למידע נוסף, ראו:</p> |
94 | | -<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2005\" class=\"external\">שאלות נפוצות על הבחירות</a></li> |
95 | | -<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2005\" class=\"external\">המועמדים</a></li></ul> |
| 92 | +<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2006\" class=\"external\">שאלות נפוצות על הבחירות</a></li> |
| 93 | +<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2006\" class=\"external\">המועמדים</a></li></ul> |
96 | 94 | ", |
97 | 95 | 'boardvote_intro_change' => "<p>כבר הצבעתם בעבר. עם זאת, באפשרותכם לשנות את הצבעתכם באמצעות הטופס המצורף למטה. אנא סמנו את תיבת הסימון ליד כל אחד מהמועמדים המועדפים עליכם.</p>", |
98 | 96 | 'boardvote_entered' => "תודה לכם, הצבעתכם נרשמה. |
— | — | @@ -124,7 +122,7 @@ |
125 | 123 | 'boardvote_unstrike' => "הסתרה", |
126 | 124 | 'boardvote_needadmin' => "רק מנהלי הבחירות יכולים לבצע פעולה זו.", |
127 | 125 | 'boardvote_sitenotice' => "<a href=\"{{localurle:{{ns:special}}:Boardvote/vote}}\">בחירות לחבר הנאמנים של ויקימדיה</a>: ההצבעה פתוחה עד 12 ביולי", |
128 | | - 'boardvote_closed' => 'ההצבעה סגורה כעת, ראו [http://meta.wikimedia.org/wiki/Elections_for_the_Board_of_Trustees_of_the_Wikimedia_Foundation%2C_2005/En את הדף על תוצאות הבחירות] בקרוב.', |
| 126 | + 'boardvote_closed' => 'ההצבעה סגורה כעת, ראו [http://meta.wikimedia.org/wiki/Elections_for_the_Board_of_Trustees_of_the_Wikimedia_Foundation%2C_2006/En את הדף על תוצאות הבחירות] בקרוב.', |
129 | 127 | 'boardvote_edits_many' => 'הרבה', |
130 | 128 | 'group-boardvote' => 'מנהלי הבחירות לחבר המנהלים', |
131 | 129 | 'group-boardvote-member' => 'מנהל הבחירות לחבר המנהלים', |
— | — | @@ -174,8 +172,8 @@ |
175 | 173 | positie. In geval de stemmen staken wordt er een tweede ronde gehouden.</p> |
176 | 174 | |
177 | 175 | <p>Meer informatie:</p> |
178 | | -<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2005\" class=\"external\">Bestuursverkiezing FAQ</a></li> |
179 | | -<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2005\" class=\"external\">Kandidaten</a></li></ul> |
| 176 | +<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2006\" class=\"external\">Bestuursverkiezing FAQ</a></li> |
| 177 | +<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2006\" class=\"external\">Kandidaten</a></li></ul> |
180 | 178 | ", |
181 | 179 | "boardvote_intro_change" => "<p>U heeft al gestemd. U kunt uw stem wijzigen via |
182 | 180 | het onderstaande formulier. Vink alstublieft de vakjes naar iedere kandidaat die |
— | — | @@ -229,8 +227,8 @@ |
230 | 228 | <p>Poderá votar em tantos candidatos quantos desejar. O candidato que apurar mais votos em cada posição será declarado vencedor dessa posição. Em caso de empate, serão lançadas votações para desempate.</p> |
231 | 229 | |
232 | 230 | <p>Para mais informações, consulte:</p> |
233 | | -<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2005\" class=\"external\">FAQ de eleição</a></li> |
234 | | -<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2005\" class=\"external\">Candidatos</a></li></ul> |
| 231 | +<ul><li><a href=\"http://meta.wikipedia.org/wiki/Election_FAQ_2006\" class=\"external\">FAQ de eleição</a></li> |
| 232 | +<li><a href=\"http://meta.wikipedia.org/wiki/Election_Candidates_2006\" class=\"external\">Candidatos</a></li></ul> |
235 | 233 | ", |
236 | 234 | 'boardvote_intro_change' => "<p>Já votou anteriormente. Contudo pode alterar o seu voto utilizando o formulário abaixo. Por favor marque a caixa ao lado de cada candidato que aprovar.</p>", |
237 | 235 | 'boardvote_entered' => "Obrigado, o seu voto foi registado. |
— | — | @@ -263,7 +261,7 @@ |
264 | 262 | 'boardvote_unstrike' => "Limpar risco", |
265 | 263 | 'boardvote_needadmin' => "Apenas administradores podem efectuar esta operação.", |
266 | 264 | 'boardvote_sitenotice' => "<a href=\"{{localurle:Especial:Boardvote/vote}}\">Comité da Fundação Wikimedia</a>: Votação aberta até 12 de Julho", |
267 | | - 'boardvote_closed' => 'As eleições estão agora encerradas, ver [http://meta.wikimedia.org/wiki/Elections_for_the_Board_of_Trustees_of_the_Wikimedia_Foundation%2C_2005/Pt a página de eleições para os resultados] brevemente.', |
| 265 | + 'boardvote_closed' => 'As eleições estão agora encerradas, ver [http://meta.wikimedia.org/wiki/Elections_for_the_Board_of_Trustees_of_the_Wikimedia_Foundation%2C_2006/Pt a página de eleições para os resultados] brevemente.', |
268 | 266 | 'boardvote_edits_many' => 'muitos', |
269 | 267 | 'group-boardvote' => 'Board vote administradores', |
270 | 268 | 'group-boardvote-member' => 'Board vote administrador', |
Index: trunk/extensions/BoardVote/BoardVote.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | $wgBoardVoteCountDate = '20060801000000'; |
24 | 24 | $wgBoardVoteStartDate = '20060901000000'; |
25 | 25 | $wgBoardVoteEndDate = '20060922000000'; |
| 26 | +$wgBoardVoteDBServer = $wgDBserver; |
26 | 27 | |
27 | 28 | # Vote admins |
28 | 29 | $wgGroupPermissions['boardvote']['boardvote'] = true; |