Index: trunk/extensions/BoardVote/GoToBoardVote_body.php |
— | — | @@ -1,14 +1,23 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) { |
| 3 | +if( !defined('MEDIAWIKI') ) { |
4 | 4 | die( "Not a valid entry point\n" ); |
5 | 5 | } |
6 | 6 | |
7 | 7 | class GoToBoardVotePage extends SpecialPage { |
8 | | - function __construct() { |
9 | | - parent::__construct( "Boardvote" ); |
| 8 | + |
| 9 | + /** |
| 10 | + * Constructor |
| 11 | + */ |
| 12 | + public function __construct() { |
| 13 | + parent::__construct( 'BoardVote' ); |
10 | 14 | } |
11 | 15 | |
12 | | - function execute( $par ) { |
| 16 | + /** |
| 17 | + * Show the special page |
| 18 | + * |
| 19 | + * @param $par Mixed: parameter passed to the page or null |
| 20 | + */ |
| 21 | + public function execute( $par ) { |
13 | 22 | global $wgOut, $wgDBname, $site, $lang, $wgLang, $wgUser; |
14 | 23 | global $wgBoardVoteEditCount, $wgBoardVoteRecentEditCount, $wgBoardVoteCountDate; |
15 | 24 | global $wgBoardVoteRecentFirstCountDate, $wgBoardVoteRecentCountDate; |
— | — | @@ -21,8 +30,7 @@ |
22 | 31 | if ( class_exists( 'CentralAuthUser' ) ) { |
23 | 32 | global $wgCentralAuthCookiePrefix; |
24 | 33 | if ( isset( $wgCentralAuthCookiePrefix ) |
25 | | - && isset( $_COOKIE[$wgCentralAuthCookiePrefix . 'Session'] ) ) |
26 | | - { |
| 34 | + && isset( $_COOKIE[$wgCentralAuthCookiePrefix . 'Session'] ) ) { |
27 | 35 | $centralSessionId = $_COOKIE[$wgCentralAuthCookiePrefix . 'Session']; |
28 | 36 | } elseif ( isset( $_COOKIE[$wgCentralAuthCookiePrefix . 'Token'] ) ) { |
29 | 37 | $centralUser = CentralAuthUser::getInstance( $wgUser ); |
— | — | @@ -33,7 +41,7 @@ |
34 | 42 | if ( $wgUser->isLoggedIn() ) { |
35 | 43 | #$url = 'http://shimmer/farm/frwiki/index.php?' . wfArrayToCGI( array( |
36 | 44 | $url = 'https://wikimedia.spi-inc.org/index.php?' . wfArrayToCGI( array( |
37 | | - 'title' => 'Special:Boardvote' . ( $par ? "/$par" : '' ), |
| 45 | + 'title' => 'Special:BoardVote' . ( $par ? "/$par" : '' ), |
38 | 46 | 'sid' => session_id(), |
39 | 47 | 'casid' => $centralSessionId, |
40 | 48 | 'db' => $wgDBname, |
— | — | @@ -42,7 +50,7 @@ |
43 | 51 | 'uselang' => $wgLang->getCode() |
44 | 52 | ) ); |
45 | 53 | |
46 | | - $wgOut->addWikiText( wfMsg( "boardvote_redirecting", $url ) ); |
| 54 | + $wgOut->addWikiMsg( 'boardvote_redirecting', $url ); |
47 | 55 | $wgOut->addMeta( 'http:Refresh', '20;url=' . htmlspecialchars( $url ) ); |
48 | 56 | } else { |
49 | 57 | $wgOut->addWikiText( wfMsgExt( 'boardvote_notloggedin', array( 'parsemag' ), $wgBoardVoteEditCount, |
Index: trunk/extensions/BoardVote/voterList.php |
— | — | @@ -51,6 +51,4 @@ |
52 | 52 | "$email\t$editCount\t$props\n" ); |
53 | 53 | } |
54 | 54 | } |
55 | | -fclose( $listFile ); |
56 | | - |
57 | | -?> |
| 55 | +fclose( $listFile ); |
\ No newline at end of file |
Index: trunk/extensions/BoardVote/BoardVote.alias.php |
— | — | @@ -2,7 +2,8 @@ |
3 | 3 | /** |
4 | 4 | * Aliases for Special:BoardVote |
5 | 5 | * |
6 | | - * @addtogroup Extensions |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
7 | 8 | */ |
8 | 9 | |
9 | 10 | $aliases = array(); |
Index: trunk/extensions/BoardVote/BoardVote_body.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) { |
| 3 | +if( !defined('MEDIAWIKI') ) { |
4 | 4 | die( "Not a valid entry point\n" ); |
5 | 5 | } |
6 | 6 | |
— | — | @@ -8,8 +8,11 @@ |
9 | 9 | var $mHasVoted, $mAction, $mUserKey, $mId, $mFinished; |
10 | 10 | var $mDb; |
11 | 11 | |
12 | | - function __construct() { |
13 | | - parent::__construct( "Boardvote" ); |
| 12 | + /** |
| 13 | + * Constructor |
| 14 | + */ |
| 15 | + public function __construct() { |
| 16 | + parent::__construct( 'BoardVote' ); |
14 | 17 | } |
15 | 18 | |
16 | 19 | function getUserFromRemote( $sid, $casid, $db, $site, $lang ) { |
— | — | @@ -113,11 +116,11 @@ |
114 | 117 | |
115 | 118 | $this->mPosted = $wgRequest->wasPosted(); |
116 | 119 | if ( method_exists( $wgRequest, 'getArray' ) ) { |
117 | | - $this->mVotedFor = $wgRequest->getArray( "candidate", array() ); |
| 120 | + $this->mVotedFor = $wgRequest->getArray( 'candidate', array() ); |
118 | 121 | } else { |
119 | | - $this->mVotedFor = $wgRequest->getVal( "candidate", array() ); |
| 122 | + $this->mVotedFor = $wgRequest->getVal( 'candidate', array() ); |
120 | 123 | } |
121 | | - $this->mId = $wgRequest->getInt( "id", 0 ); |
| 124 | + $this->mId = $wgRequest->getInt( 'id', 0 ); |
122 | 125 | $this->mValidVote = $this->mPosted ? $this->validVote() : false; |
123 | 126 | |
124 | 127 | $this->mHasVoted = $this->hasVoted(); |
— | — | @@ -125,12 +128,16 @@ |
126 | 129 | if ( $par ) { |
127 | 130 | $this->mAction = $par; |
128 | 131 | } else { |
129 | | - $this->mAction = $wgRequest->getText( "action" ); |
| 132 | + $this->mAction = $wgRequest->getText( 'action' ); |
130 | 133 | } |
131 | 134 | } |
132 | 135 | |
133 | | - |
134 | | - function execute( $par ) { |
| 136 | + /** |
| 137 | + * Show the special page |
| 138 | + * |
| 139 | + * @param $par Mixed: parameter passed to the page or null |
| 140 | + */ |
| 141 | + public function execute( $par ) { |
135 | 142 | global $wgOut, $wgBoardVoteStartDate, $wgBoardVoteEndDate; |
136 | 143 | |
137 | 144 | wfLoadExtensionMessages( 'BoardVote' ); |
— | — | @@ -144,28 +151,27 @@ |
145 | 152 | } |
146 | 153 | |
147 | 154 | if ( $this->mUserKey ) { |
148 | | - $wgOut->addWikiText( wfMsg( 'boardvote_welcome', wfEscapeWikiText( $this->mUserKey ) ) ); |
| 155 | + $wgOut->addWikiMsg( 'boardvote_welcome', wfEscapeWikiText( $this->mUserKey ) ); |
149 | 156 | } |
150 | 157 | |
151 | 158 | if ( wfTimestampNow() < $wgBoardVoteStartDate && !$this->isAdmin() ) { |
152 | | - $wgOut->addWikiText( wfMsg( 'boardvote_notstarted' ) ); |
| 159 | + $wgOut->addWikiMsg( 'boardvote_notstarted' ); |
153 | 160 | return; |
154 | 161 | } |
155 | 162 | |
156 | 163 | if ( $this->mBlocked ) { |
157 | | - $wgOut->addWikiText( wfMsg( 'boardvote_blocked' ) ); |
| 164 | + $wgOut->addWikiMsg( 'boardvote_blocked' ); |
158 | 165 | return; |
159 | 166 | } |
160 | 167 | |
161 | 168 | if ( $this->mBot ) { |
162 | | - $wgOut->addWikiText( wfMsg( 'boardvote_bot' ) ); |
| 169 | + $wgOut->addWikiMsg( 'boardvote_bot' ); |
163 | 170 | return; |
164 | 171 | } |
165 | 172 | |
166 | 173 | if ( wfTimestampNow() > $wgBoardVoteEndDate ) { |
167 | 174 | $this->mFinished = true; |
168 | | - |
169 | | - $wgOut->addWikiText( wfMsg( 'boardvote_closed' ) ); |
| 175 | + $wgOut->addWikiMsg( 'boardvote_closed' ); |
170 | 176 | } else { |
171 | 177 | $this->mFinished = false; |
172 | 178 | } |
— | — | @@ -202,7 +208,7 @@ |
203 | 209 | |
204 | 210 | function displayEntry() { |
205 | 211 | global $wgOut; |
206 | | - $wgOut->addWikiText( wfMsg( "boardvote_entry" ) ); |
| 212 | + $wgOut->addWikiMsg( 'boardvote_entry' ); |
207 | 213 | } |
208 | 214 | |
209 | 215 | function getDB() { |
— | — | @@ -212,8 +218,8 @@ |
213 | 219 | $this->mDb = new Database( $wgBoardVoteDBServer, $wgDBuser, $wgDBpassword, |
214 | 220 | $wgBoardVoteDB, /*failfn*/false, /*flags*/0, /*prefix*/'' ); |
215 | 221 | if ( !$this->mDb->isOpen() ) { |
216 | | - // This should be handled inside the constructor, but we'll check just in case |
217 | | - throw new MWException( "DB connection failed unexpectedly" ); |
| 222 | + // This should be handled inside the constructor, but we'll check just in case |
| 223 | + throw new MWException( "DB connection failed unexpectedly" ); |
218 | 224 | } |
219 | 225 | } |
220 | 226 | return $this->mDb; |
— | — | @@ -222,7 +228,7 @@ |
223 | 229 | function hasVoted() { |
224 | 230 | $dbr =& $this->getDB(); |
225 | 231 | $row = $dbr->selectRow( 'vote_log', array( "1" ), |
226 | | - array( "log_user_key" => $this->mUserKey ), "BoardVotePage::getUserVote" ); |
| 232 | + array( 'log_user_key' => $this->mUserKey ), __METHOD__ ); |
227 | 233 | if ( $row === false ) { |
228 | 234 | return false; |
229 | 235 | } else { |
— | — | @@ -232,19 +238,16 @@ |
233 | 239 | |
234 | 240 | function logVote() { |
235 | 241 | global $wgUser, $wgDBname, $wgOut, $wgGPGPubKey, $wgRequest; |
236 | | - $fname = "BoardVotePage::logVote"; |
237 | 242 | |
238 | 243 | $now = wfTimestampNow(); |
239 | 244 | $record = $this->getRecord(); |
240 | 245 | $encrypted = $this->encrypt( $record ); |
241 | 246 | $gpgKey = file_get_contents( $wgGPGPubKey ); |
242 | 247 | $dbw =& $this->getDB(); |
243 | | - $log = $dbw->tableName( "vote_log" ); |
244 | 248 | |
245 | 249 | # Mark previous votes as old |
246 | 250 | $encKey = $dbw->strencode( $this->mUserKey ); |
247 | | - $sql = "UPDATE $log SET log_current=0 WHERE log_user_key='$encKey'"; |
248 | | - $dbw->query( $sql, $fname ); |
| 251 | + $dbw->update( 'vote_log', array( 'log_current' => 0 ), array( 'log_user_key' => $encKey ), __METHOD__ ); |
249 | 252 | |
250 | 253 | # Add vote to log |
251 | 254 | $xff = @$_SERVER['HTTP_X_FORWARDED_FOR']; |
— | — | @@ -254,42 +257,42 @@ |
255 | 258 | |
256 | 259 | $tokenMatch = $wgUser->matchEditToken( $wgRequest->getVal( 'edit_token' ) ); |
257 | 260 | |
258 | | - $dbw->insert( $log, array( |
259 | | - "log_user" => 0, |
260 | | - "log_user_text" => '', |
261 | | - "log_user_key" => $this->mUserKey, |
262 | | - "log_wiki" => $wgDBname, |
263 | | - "log_record" => $encrypted, |
264 | | - "log_ip" => wfGetIP(), |
265 | | - "log_xff" => $xff, |
266 | | - "log_ua" => $_SERVER['HTTP_USER_AGENT'], |
267 | | - "log_timestamp" => $now, |
268 | | - "log_current" => 1, |
269 | | - "log_token_match" => $tokenMatch ? 1 : 0, |
270 | | - ), $fname ); |
| 261 | + $dbw->insert( 'vote_log', array( |
| 262 | + 'log_user' => 0, |
| 263 | + 'log_user_text' => '', |
| 264 | + 'log_user_key' => $this->mUserKey, |
| 265 | + 'log_wiki' => $wgDBname, |
| 266 | + 'log_record' => $encrypted, |
| 267 | + 'log_ip' => wfGetIP(), |
| 268 | + 'log_xff' => $xff, |
| 269 | + 'log_ua' => $_SERVER['HTTP_USER_AGENT'], |
| 270 | + 'log_timestamp' => $now, |
| 271 | + 'log_current' => 1, |
| 272 | + 'log_token_match' => $tokenMatch ? 1 : 0, |
| 273 | + ), __METHOD__ ); |
271 | 274 | |
272 | | - $wgOut->addWikiText( wfMsg( "boardvote_entered", $record, $gpgKey, $encrypted ) ); |
| 275 | + $wgOut->addWikiMsg( 'boardvote_entered', $record, $gpgKey, $encrypted ); |
273 | 276 | } |
274 | 277 | |
275 | 278 | function displayVote() { |
276 | 279 | global $wgBoardCandidates, $wgOut; |
277 | 280 | |
278 | | - $thisTitle = Title::makeTitle( NS_SPECIAL, "Boardvote" ); |
| 281 | + $thisTitle = SpecialPage::getTitleFor( 'BoardVote' ); |
279 | 282 | $action = $thisTitle->escapeLocalURL( "action=vote" ); |
280 | 283 | if ( $this->mHasVoted ) { |
281 | | - $intro = wfMsg( "boardvote_intro_change" ); |
| 284 | + $intro = wfMsg( 'boardvote_intro_change' ); |
282 | 285 | } else { |
283 | | - $intro = wfMsg( "boardvote_intro" ); |
| 286 | + $intro = wfMsg( 'boardvote_intro' ); |
284 | 287 | } |
285 | 288 | |
286 | | - $ok = wfMsgHtml( "boardvote_submit" ); |
| 289 | + $ok = wfMsgHtml( 'boardvote_submit' ); |
287 | 290 | |
288 | 291 | $candidates = array(); |
289 | 292 | foreach( $wgBoardCandidates as $i => $candidate ) { |
290 | 293 | $candidates[] = array( $i, $candidate ); |
291 | 294 | } |
292 | 295 | |
293 | | - srand ((float)microtime()*1000000); |
| 296 | + srand( (float)microtime() * 1000000 ); |
294 | 297 | shuffle( $candidates ); |
295 | 298 | |
296 | 299 | $text = " |
— | — | @@ -306,7 +309,7 @@ |
307 | 310 | <td><input name=\"submit\" type=\"submit\" value=\"$ok\"> |
308 | 311 | <input type='hidden' name='edit_token' value=\"{$token}\" /></td> |
309 | 312 | </tr></table></form>"; |
310 | | - $text .= wfMsg( "boardvote_footer" ); |
| 313 | + $text .= wfMsg( 'boardvote_footer' ); |
311 | 314 | $wgOut->addHTML( $text ); |
312 | 315 | } |
313 | 316 | |
— | — | @@ -343,7 +346,7 @@ |
344 | 347 | |
345 | 348 | function displayInvalidVoteError() { |
346 | 349 | global $wgOut; |
347 | | - $wgOut->addWikiText( wfMsg( "boardvote_invalidentered" ) ); |
| 350 | + $wgOut->addWikiMsg( 'boardvote_invalidentered' ); |
348 | 351 | } |
349 | 352 | |
350 | 353 | function getRecord() { |
— | — | @@ -417,28 +420,26 @@ |
418 | 421 | } |
419 | 422 | |
420 | 423 | function displayList() { |
421 | | - global $wgOut, $wgOutputEncoding, $wgLang, $wgUser; |
| 424 | + global $wgOut, $wgLang, $wgUser; |
422 | 425 | |
423 | 426 | $userRights = $wgUser->getRights(); |
424 | 427 | $admin = $this->isAdmin(); |
425 | 428 | $dbr =& $this->getDB(); |
426 | | - $log = $dbr->tableName( "vote_log" ); |
427 | 429 | |
428 | | - $sql = "SELECT * FROM $log ORDER BY log_user_key"; |
429 | | - $res = $dbr->query( $sql, "BoardVotePage::list" ); |
| 430 | + $res = $dbr->select( 'vote_log', '*', array(), __METHOD__, array( 'ORDER BY' => 'log_user_key' ) ); |
430 | 431 | if ( $dbr->numRows( $res ) == 0 ) { |
431 | | - $wgOut->addWikiText( wfMsg( "boardvote_novotes" ) ); |
| 432 | + $wgOut->addWikiMsg( 'boardvote_novotes' ); |
432 | 433 | return; |
433 | 434 | } |
434 | | - $thisTitle = Title::makeTitle( NS_SPECIAL, "Boardvote" ); |
| 435 | + $thisTitle = SpecialPage::getTitleFor( 'BoardVote' ); |
435 | 436 | $sk = $wgUser->getSkin(); |
436 | | - $dumpLink = $sk->makeKnownLinkObj( $thisTitle, wfMsg( "boardvote_dumplink" ), "action=dump" ); |
| 437 | + $dumpLink = $sk->makeKnownLinkObj( $thisTitle, wfMsg( 'boardvote_dumplink' ), "action=dump" ); |
437 | 438 | |
438 | | - $intro = wfMsg( "boardvote_listintro", $dumpLink ); |
439 | | - $hTime = wfMsg( "boardvote_time" ); |
440 | | - $hUser = wfMsg( "boardvote_user" ); |
441 | | - $hIp = wfMsg( "boardvote_ip" ); |
442 | | - $hUa = wfMsg( "boardvote_ua" ); |
| 439 | + $intro = wfMsg( 'boardvote_listintro', $dumpLink ); |
| 440 | + $hTime = wfMsg( 'boardvote_time' ); |
| 441 | + $hUser = wfMsg( 'boardvote_user' ); |
| 442 | + $hIp = wfMsg( 'boardvote_ip' ); |
| 443 | + $hUa = wfMsg( 'boardvote_ua' ); |
443 | 444 | |
444 | 445 | $s = "$intro <table border=1><tr><th> |
445 | 446 | $hUser |
— | — | @@ -476,10 +477,10 @@ |
477 | 478 | |
478 | 479 | if ( $admin ) { |
479 | 480 | if ( $row->log_strike ) { |
480 | | - $strikeLink = $sk->makeKnownLinkObj( $thisTitle, wfMsg( "boardvote_unstrike" ), |
| 481 | + $strikeLink = $sk->makeKnownLinkObj( $thisTitle, wfMsg( 'boardvote_unstrike' ), |
481 | 482 | "action=unstrike&id={$row->log_id}" ); |
482 | 483 | } else { |
483 | | - $strikeLink = $sk->makeKnownLinkObj( $thisTitle, wfMsg( "boardvote_strike" ), |
| 484 | + $strikeLink = $sk->makeKnownLinkObj( $thisTitle, wfMsg( 'boardvote_strike' ), |
484 | 485 | "action=strike&id={$row->log_id}" ); |
485 | 486 | } |
486 | 487 | |
— | — | @@ -499,14 +500,12 @@ |
500 | 501 | } |
501 | 502 | |
502 | 503 | function dump() { |
503 | | - global $wgOut, $wgOutputEncoding, $wgLang; |
| 504 | + global $wgOut, $wgLang; |
504 | 505 | $dbr =& $this->getDB(); |
505 | | - $log = $dbr->tableName( "vote_log" ); |
506 | 506 | |
507 | | - $sql = "SELECT log_record FROM $log WHERE log_current=1 AND log_strike=0"; |
508 | | - $res = $dbr->query( $sql, DB_SLAVE, "BoardVotePage::list" ); |
| 507 | + $res = $dbr->select( 'vote_log', array( 'log_record' ), array( 'log_current' => 1, 'log_strike' => 0 ), __METHOD__ ); |
509 | 508 | if ( $dbr->numRows( $res ) == 0 ) { |
510 | | - $wgOut->addWikiText( wfMsg( "boardvote_novotes" ) ); |
| 509 | + $wgOut->addWikiMsg( 'boardvote_novotes' ); |
511 | 510 | return; |
512 | 511 | } |
513 | 512 | |
— | — | @@ -518,10 +517,16 @@ |
519 | 518 | $wgOut->addHTML( $s ); |
520 | 519 | } |
521 | 520 | |
| 521 | + /** |
| 522 | + * Checks if the user is allowed to administrate board elections |
| 523 | + * by checking for the 'boardvote' user right |
| 524 | + * |
| 525 | + * @return boolean: true if the user has 'boardvote' right, otherwise false |
| 526 | + */ |
522 | 527 | function isAdmin() { |
523 | 528 | global $wgUser; |
524 | 529 | $userRights = $wgUser->getRights(); |
525 | | - if ( in_array( "boardvote", $userRights ) ) { |
| 530 | + if ( in_array( 'boardvote', $userRights ) ) { |
526 | 531 | return true; |
527 | 532 | } else { |
528 | 533 | return false; |
— | — | @@ -532,17 +537,15 @@ |
533 | 538 | global $wgOut; |
534 | 539 | |
535 | 540 | $dbw =& $this->getDB(); |
536 | | - $log = $dbw->tableName( "vote_log" ); |
537 | 541 | |
538 | 542 | if ( !$this->isAdmin() ) { |
539 | | - $wgOut->addWikiText( wfMsg( "boardvote_needadmin" ) ); |
| 543 | + $wgOut->addWikiMsg( 'boardvote_needadmin' ); |
540 | 544 | return; |
541 | 545 | } |
542 | 546 | $value = $unstrike ? 0 : 1; |
543 | | - $sql = "UPDATE $log SET log_strike=$value WHERE log_id=$id"; |
544 | | - $dbw->query( $sql, "BoardVotePage::strike" ); |
| 547 | + $dbw->update( 'vote_log', array( 'log_strike' => $value ), array( 'log_id' => $id ), __METHOD__ ); |
545 | 548 | |
546 | | - $title = Title::makeTitle( NS_SPECIAL, "Boardvote" ); |
| 549 | + $title = SpecialPage::getTitleFor( 'BoardVote' ); |
547 | 550 | $wgOut->redirect( $title->getFullURL( "action=list" ) ); |
548 | 551 | } |
549 | 552 | |
— | — | @@ -557,4 +560,4 @@ |
558 | 561 | |
559 | 562 | return true; |
560 | 563 | } |
561 | | -} |
| 564 | +} |
\ No newline at end of file |
Index: trunk/extensions/BoardVote/BoardVote.i18n.php |
— | — | @@ -2,18 +2,22 @@ |
3 | 3 | /** |
4 | 4 | * Internationalisation file for BoardVote extension. |
5 | 5 | * |
6 | | - * @addtogroup Extensions |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
7 | 8 | */ |
8 | 9 | |
9 | 10 | $messages = array(); |
10 | | - |
| 11 | +/** English |
| 12 | + * @author Tim Starling |
| 13 | + * @author Kwan Ting Chan |
| 14 | +*/ |
11 | 15 | $messages['en'] = array( |
12 | | - 'boardvote' => "Wikimedia Board of Trustees election", |
13 | | - 'boardvote-desc' => '[[meta:Board elections/2008|Wikimedia Board of Trustees election]]', |
14 | | - 'boardvote_entry' => "* [[Special:Boardvote/vote|Vote]] |
15 | | -* [[Special:Boardvote/list|List votes to date]] |
16 | | -* [[Special:Boardvote/dump|Dump encrypted election record]]", |
17 | | - 'boardvote_intro' => "<p>Welcome to the 2008 election for the Wikimedia Board of Trustees. |
| 16 | + 'boardvote' => 'Wikimedia Board of Trustees election', |
| 17 | + 'boardvote-desc' => '[[meta:Board elections/2008|Wikimedia Board of Trustees election]]', |
| 18 | + 'boardvote_entry' => "* [[Special:BoardVote/vote|Vote]] |
| 19 | +* [[Special:BoardVote/list|List votes to date]] |
| 20 | +* [[Special:BoardVote/dump|Dump encrypted election record]]", |
| 21 | + 'boardvote_intro' => "<p>Welcome to the 2008 election for the Wikimedia Board of Trustees. |
18 | 22 | We are voting for one person to represent the community of users on the various Wikimedia projects. |
19 | 23 | They will help to determine the future direction that the Wikimedia projects will take, individually and as a group, and represent <em>your</em> interests and concerns to the Board of Trustees. |
20 | 24 | They will decide on ways to generate income and the allocation of moneys raised.</p> |
— | — | @@ -31,12 +35,12 @@ |
32 | 36 | <ul><li><a href=\"http://meta.wikimedia.org/wiki/Board_elections/2008\" class=\"external\">Board elections 2008</a></li> |
33 | 37 | <li><a href=\"http://meta.wikimedia.org/wiki/Board_elections/2008/Candidates\" class=\"external\">Candidates</a></li> |
34 | 38 | <li><a href=\"http://en.wikipedia.org/wiki/Schulze_method\" class=\"external\">Schulze method</a></li></ul>", |
35 | | - 'boardvote_intro_change' => "<p>You have voted before. However you may change |
| 39 | + 'boardvote_intro_change' => "<p>You have voted before. However you may change |
36 | 40 | your vote using the form below. Please rank the candidates in your order of preferences, whereby a smaller number |
37 | 41 | indicate a higher preference for that particular candidate. You may give the same preference to more than one |
38 | 42 | candidate and may keep candidates unranked.</p>", |
39 | | - 'boardvote_footer' => " ", # Do not translate this |
40 | | - 'boardvote_entered' => "Thank you, your vote has been recorded. |
| 43 | + 'boardvote_footer' => " ", # Do not translate this |
| 44 | + 'boardvote_entered' => "Thank you, your vote has been recorded. |
41 | 45 | |
42 | 46 | If you wish, you may record the following details. Your voting record is: |
43 | 47 | |
— | — | @@ -46,55 +50,54 @@ |
47 | 51 | |
48 | 52 | <pre>$2</pre> |
49 | 53 | |
50 | | -The resulting encrypted version follows. It will be [[Special:Boardvote/dump|displayed publicly]]. |
| 54 | +The resulting encrypted version follows. It will be [[Special:BoardVote/dump|displayed publicly]]. |
51 | 55 | |
52 | 56 | <pre>$3</pre> |
53 | 57 | |
54 | | -[[Special:Boardvote/entry|Back]]", |
55 | | - 'boardvote_invalidentered'=> "<p><strong>Error</strong>: candidate preference must be expressed in positive whole number only (1, 2, 3, ....), or |
| 58 | +[[Special:BoardVote/entry|Back]]", |
| 59 | + 'boardvote_invalidentered' => "<p><strong>Error</strong>: candidate preference must be expressed in positive whole number only (1, 2, 3, ....), or |
56 | 60 | left empty.</p>", |
57 | | - 'boardvote_nosession' => "Your Wikimedia user ID could not be determined. |
58 | | -Please log in to the wiki where you are qualified to vote, and go to <nowiki>[[Special:Boardvote]]</nowiki>. |
| 61 | + 'boardvote_nosession' => "Your Wikimedia user ID could not be determined. |
| 62 | +Please log in to the wiki where you are qualified to vote, and go to <nowiki>[[Special:BoardVote]]</nowiki>. |
59 | 63 | You must use an account with at least $1 {{PLURAL:$1|contribution|contributions}} before $2, and have made at least $3 {{PLURAL:$3|contribution|contributions}} between $4 and $5.", |
60 | | - 'boardvote_notloggedin' => "You are not logged in. |
| 64 | + 'boardvote_notloggedin' => "You are not logged in. |
61 | 65 | To vote, you must use an account with at least $1 {{PLURAL:$1|contribution|contributions}} before $2, and have made at least $3 {{PLURAL:$3|contribution|contributions}} between $4 and $5.", |
62 | | - 'boardvote_notqualified' => "You are not qualified to vote in this election. |
| 66 | + 'boardvote_notqualified' => "You are not qualified to vote in this election. |
63 | 67 | You need to have made at least $1 {{PLURAL:$1|contribution|contributions}} before $2, and have made at least $3 {{PLURAL:$3|contribution|contributions}} between $4 and $5.", |
64 | | - 'boardvote_novotes' => "Nobody has voted yet.", |
65 | | - 'boardvote_time' => "Time", |
66 | | - 'boardvote_user' => "User", |
67 | | - 'boardvote_edits' => "Edits", |
68 | | - 'boardvote_days' => "Days", |
69 | | - 'boardvote_ip' => "IP", |
70 | | - 'boardvote_ua' => "User agent", |
71 | | - 'boardvote_listintro' => "<p>This is a list of all votes which have been recorded to date. |
| 68 | + 'boardvote_novotes' => 'Nobody has voted yet.', |
| 69 | + 'boardvote_time' => 'Time', |
| 70 | + 'boardvote_user' => 'User', |
| 71 | + 'boardvote_edits' => 'Edits', |
| 72 | + 'boardvote_days' => 'Days', |
| 73 | + 'boardvote_ip' => 'IP', |
| 74 | + 'boardvote_ua' => 'User agent', |
| 75 | + 'boardvote_listintro' => "<p>This is a list of all votes which have been recorded to date. |
72 | 76 | $1 for the encrypted data.</p>", |
73 | | - 'boardvote_dumplink' => "Click here", |
74 | | - 'boardvote_submit' => 'OK', |
75 | | - 'boardvote_strike' => "Strike", |
76 | | - 'boardvote_unstrike' => "Unstrike", |
77 | | - 'boardvote_needadmin' => "Only election administrators can perform this operation.", |
78 | | - 'boardvote_sitenotice' => "<a href=\"{{localurle:Special:Boardvote/vote}}\">Wikimedia Board Elections</a>: |
79 | | -Vote open until June 22", |
80 | | - 'boardvote_notstarted' => 'Voting has not yet started', |
81 | | - 'boardvote_closed' => 'Voting is now closed, see [http://meta.wikimedia.org/wiki/Board_elections/2008/Results the elections page for results] soon.', |
82 | | - 'boardvote_edits_many' => 'many', |
83 | | - 'group-boardvote' => 'Board vote admins', |
84 | | - 'group-boardvote-member' => 'board vote admin', |
85 | | - 'grouppage-boardvote' => '{{ns:project}}:Board vote admin', |
86 | | - 'boardvote_blocked' => 'You have been blocked on your registered wiki. |
| 77 | + 'boardvote_dumplink' => 'Click here', |
| 78 | + 'boardvote_submit' => 'OK', |
| 79 | + 'boardvote_strike' => 'Strike', |
| 80 | + 'boardvote_unstrike' => 'Unstrike', |
| 81 | + 'boardvote_needadmin' => 'Only election administrators can perform this operation.', |
| 82 | + 'boardvote_sitenotice' => '<a href="{{localurle:Special:BoardVote/vote}}">Wikimedia Board Elections</a>: |
| 83 | +Vote open until June 22', |
| 84 | + 'boardvote_notstarted' => 'Voting has not yet started', |
| 85 | + 'boardvote_closed' => 'Voting is now closed, see [http://meta.wikimedia.org/wiki/Board_elections/2008/Results the elections page for results] soon.', |
| 86 | + 'boardvote_edits_many' => 'many', |
| 87 | + 'group-boardvote' => 'Board vote admins', |
| 88 | + 'group-boardvote-member' => 'board vote admin', |
| 89 | + 'grouppage-boardvote' => '{{ns:project}}:Board vote admin', |
| 90 | + 'boardvote_blocked' => 'You have been blocked on your registered wiki. |
87 | 91 | Blocked users are not allowed to vote.', |
88 | | - 'boardvote_bot' => 'You are flagged as a bot on your registered wiki. |
| 92 | + 'boardvote_bot' => 'You are flagged as a bot on your registered wiki. |
89 | 93 | Bot accounts are not allowed to vote.', |
90 | | - 'boardvote_welcome' => "Welcome '''$1'''!", |
91 | | - 'go_to_board_vote' => 'Wikimedia Board Elections 2008', |
92 | | - 'boardvote_redirecting' => 'For improved security and transparency, we are running the vote on an external, independently controlled server. |
| 94 | + 'boardvote_welcome' => "Welcome '''$1'''!", |
| 95 | + 'go_to_board_vote' => 'Wikimedia Board Elections 2008', |
| 96 | + 'boardvote_redirecting' => 'For improved security and transparency, we are running the vote on an external, independently controlled server. |
93 | 97 | |
94 | 98 | You will be redirected to this external server in 20 seconds. [$1 Click here] to go there now. |
95 | 99 | |
96 | 100 | A security warning about an unsigned certificate may be displayed.', |
97 | | - |
98 | | - 'right-boardvote' => 'Administer elections', |
| 101 | + 'right-boardvote' => 'Administer elections', |
99 | 102 | ); |
100 | 103 | |
101 | 104 | /** Message documentation (Message documentation) |
Index: trunk/extensions/BoardVote/BoardVote.php |
— | — | @@ -1,28 +1,36 @@ |
2 | 2 | <?php |
| 3 | +/** |
| 4 | + * Wikimedia Foundation Board of Trustees Election |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @author Tim Starling <tstarling@wikimedia.org> |
| 9 | + * @author Kwan Ting Chan |
| 10 | + * @link http://www.mediawiki.org/wiki/Extension:BoardVote Documentation |
| 11 | + */ |
3 | 12 | |
4 | | -# Wikimedia Foundation Board of Trustees Election |
5 | | - |
6 | 13 | # Not a valid entry point, skip unless MEDIAWIKI is defined |
7 | | -if (!defined('MEDIAWIKI')) { |
| 14 | +if( !defined('MEDIAWIKI') ) { |
8 | 15 | die( "Not a valid entry point\n" ); |
9 | 16 | } |
10 | 17 | |
11 | 18 | # Extension credits |
12 | 19 | $wgExtensionCredits['other'][] = array( |
13 | | - 'name' => 'BoardVote', |
14 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:BoardVote', |
15 | | - 'svn-date' => '$LastChangedDate$', |
16 | | - 'svn-revision' => '$LastChangedRevision$', |
17 | | - 'description' => '[[meta:Board elections|Wikimedia Board of Trustees election]]', |
| 20 | + 'name' => 'BoardVote', |
| 21 | + 'author' => array( 'Tim Starling', 'Kwan Ting Chan', 'others' ) |
| 22 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:BoardVote', |
| 23 | + 'svn-date' => '$LastChangedDate$', |
| 24 | + 'svn-revision' => '$LastChangedRevision$', |
| 25 | + 'description' => '[[meta:Board elections|Wikimedia Board of Trustees election]]', |
18 | 26 | 'descriptionmsg' => 'boardvote-desc', |
19 | 27 | ); |
20 | 28 | |
21 | 29 | # Default settings |
22 | | -$wgBoardVoteDB = "boardvote"; |
| 30 | +$wgBoardVoteDB = 'boardvote'; |
23 | 31 | $wgBoardCandidates = array(); |
24 | | -/* $wgBoardCandidates = array( "John Doe", "Jane Doe", "Joe Bloggs", "John Smith", "A. N. Other" ); */ |
25 | | -$wgGPGCommand = "gpg"; |
26 | | -$wgGPGRecipient = "boardvote"; |
| 32 | +/* $wgBoardCandidates = array( 'John Doe', 'Jane Doe', 'Joe Bloggs', 'John Smith', 'A. N. Other' ); */ |
| 33 | +$wgGPGCommand = 'gpg'; |
| 34 | +$wgGPGRecipient = 'boardvote'; |
27 | 35 | $wgGPGHomedir = false; |
28 | 36 | $wgGPGPubKey = "C:\\Program Files\\GNU\\GnuPG\\pub.txt"; |
29 | 37 | $wgBoardVoteEditCount = 600; |
— | — | @@ -31,24 +39,25 @@ |
32 | 40 | $wgBoardVoteRecentFirstCountDate = '20080101000000'; |
33 | 41 | $wgBoardVoteRecentCountDate = '20080529000000'; |
34 | 42 | $wgBoardVoteStartDate = '20080601000000'; |
35 | | -$wgBoardVoteEndDate = '20080622000000'; |
| 43 | +$wgBoardVoteEndDate = '20080622000000'; |
36 | 44 | $wgBoardVoteDBServer = $wgDBserver; |
37 | 45 | |
38 | 46 | # Vote admins |
| 47 | +$wgAvailableRights[] = 'boardvote'; |
39 | 48 | $wgGroupPermissions['boardvote']['boardvote'] = true; |
40 | | -$wgAvailableRights[] = 'boardvote'; |
41 | 49 | |
| 50 | +// Set up the new special page |
42 | 51 | $dir = dirname(__FILE__) . '/'; |
43 | 52 | $wgExtensionMessagesFiles['BoardVote'] = $dir . 'BoardVote.i18n.php'; |
44 | 53 | $wgExtensionAliasesFiles['BoardVote'] = $dir . 'BoardVote.alias.php'; |
45 | 54 | |
46 | 55 | if ( !defined( 'BOARDVOTE_REDIRECT_ONLY' ) ) { |
47 | 56 | $wgAutoloadClasses['BoardVotePage'] = $dir . 'BoardVote_body.php'; |
48 | | - $wgSpecialPages['Boardvote'] = 'BoardVotePage'; |
| 57 | + $wgSpecialPages['BoardVote'] = 'BoardVotePage'; |
49 | 58 | $wgExtensionFunctions[] = 'wfSetupBoardVote'; |
50 | 59 | } else { |
51 | 60 | $wgAutoloadClasses['GoToBoardVotePage'] = $dir . 'GoToBoardVote_body.php'; |
52 | | - $wgSpecialPages['Boardvote'] = 'GoToBoardVotePage'; |
| 61 | + $wgSpecialPages['BoardVote'] = 'GoToBoardVotePage'; |
53 | 62 | } |
54 | 63 | |
55 | 64 | function wfSetupBoardVote() { |