r64479 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64478‎ | r64479 | r64480 >
Date:11:14, 1 April 2010
Author:jan
Status:deferred
Tags:
Comment:
Add the poll-score right for viewing the score of the Polls
Modified paths:
  • /trunk/extensions/Poll/Poll.i18n.php (modified) (history)
  • /trunk/extensions/Poll/Poll.php (modified) (history)
  • /trunk/extensions/Poll/Poll_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Poll/Poll_body.php
@@ -20,17 +20,22 @@
2121 wfLoadExtensionMessages( 'Poll' );
2222
2323 $this->setHeaders();
 24+
 25+ $skin = $wgUser->getSkin();
2426
2527 # Get request data. Default the action to list if none given
2628 $action = htmlentities( $wgRequest->getText( 'action', 'list' ) );
2729 $id = htmlentities( $wgRequest->getText( 'id' ) );
 30+ $page = htmlentities( $wgRequest->getText( 'page', 1 ) );
2831
2932 # Blocked users can't use this except to list
3033 if( $wgUser->isBlocked() && $action != 'list' ) {
3134 $wgOut->addWikiMsg( 'poll-create-block-error' );
32 - $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
 35+ $wgOut->addHtml( $skin->link( $this->getTitle(), wfMsg('poll-back'), array(), array( 'action' => 'list' ) ) );
3336 return;
3437 }
 38+
 39+ $this->start();
3540
3641 # Handle the action
3742 switch( $action ) {
@@ -44,11 +49,42 @@
4550 case 'submit':
4651 $this->$action( $id );
4752 break;
 53+ case 'list_old':
 54+ $this->list_old( $page );
 55+ break;
4856 case 'list':
4957 default:
5058 $this->make_list();
5159 }
5260 }
 61+
 62+ public function start() {
 63+ $dbr = wfGetDB( DB_SLAVE );
 64+ $dbw = wfGetDB( DB_MASTER );
 65+
 66+ $query_log = $dbr->select( 'poll_start_log', 'time', '', 'Database::select', array( 'ORDER BY' => 'time DESC', 'LIMIT' => '1' ) );
 67+ while( $row = $dbr->fetchObject( $query_log ) ) {
 68+ $log_time = $row->time;
 69+ }
 70+ if( !isset( $log_time ) OR $log_time == "" ) $log_time = 0;
 71+ $log_diff = time() - $log_time;
 72+ if( $log_diff <= 3600 ) return;
 73+
 74+ $query = $dbr->select( 'poll', 'id, starttime, runtime' );
 75+
 76+ while( $row = $dbr->fetchObject( $query ) ) {
 77+ $starttime = $row->starttime;
 78+ $runtime = $row->runtime;
 79+ $id = $row->id;
 80+ $sum = $starttime + $runtime;
 81+
 82+ if( $sum <= time() ) {
 83+ $dbw->update( 'poll', array( 'end' => 1 ), array( 'id' => $id ) );
 84+ }
 85+ }
 86+
 87+ $dbw->insert( 'poll_start_log', array( 'time' => time() ) );
 88+ }
5389
5490 // This function create a list with all polls that are in the DB
5591 public function make_list() {
@@ -56,11 +92,14 @@
5793 $wgOut->setPagetitle( wfMsg( 'poll' ) );
5894
5995 $dbr = wfGetDB( DB_SLAVE );
60 - $query = $dbr->select( 'poll', 'question, dis, id' );
 96+ $query = $dbr->select( 'poll', 'question, dis, id', array( 'end' => 0 ) );
 97+
 98+ $wgOut->addHtml( '<ul>' );
 99+ $wgOut->addHtml( '<li><a href="'.$this->getTitle()->getFullURL('action=create').'">'.wfMsg( 'poll-create-link' ).'</a></li>' );
 100+ $wgOut->addHtml( '<li><a href="'.$this->getTitle()->getFullURL('action=list_old').'">'.wfMsg( 'poll-list-old' ).'</a></li>' );
 101+ $wgOut->addHtml( '</ul>' );
61102
62 - $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=create').'">'.wfMsg( 'poll-create-link' ).'</a>' );
63 -
64 - $wgOut->addWikiMsg( 'poll-list-current' );
 103+ $wgOut->addWikiText( '== '.wfMsg( 'poll-list-current' ).' ==' );
65104 $wgOut->addHtml( Xml::openElement( 'table' ) );
66105 $wgOut->addHtml( '<tr><th>'.wfMsg( 'poll-question' ).'</th><th>'.wfMsg( 'poll-dis' ).'</th><th>&nbsp;</th></tr>' );
67106
@@ -73,7 +112,40 @@
74113 $wgOut->addHtml( Xml::closeElement( 'table' ) );
75114
76115 }
 116+
 117+ public function list_old( $page ) {
 118+ global $wgOut;
 119+ $wgOut->setPagetitle( wfMsg( 'poll' ) );
 120+
 121+ if( $page > 1 ) {
 122+ $page *= 50;
 123+ $limit = $page.', 50';
 124+ }
 125+ else {
 126+ $limit = '50';
 127+ }
77128
 129+ $dbr = wfGetDB( DB_SLAVE );
 130+ $query = $dbr->select( 'poll', 'question, dis, id', array( 'end' => 1 ), 'Database::select', array( 'ORDER BY' => 'id DESC', 'LIMIT' => $limit ) );
 131+
 132+ $wgOut->addHtml( '<ul>' );
 133+ $wgOut->addHtml( '<li><a href="'.$this->getTitle()->getFullURL('action=create').'">'.wfMsg( 'poll-create-link' ).'</a></li>' );
 134+ $wgOut->addHtml( '<li><a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg( 'poll-list-current' ).'</a></li>' );
 135+ $wgOut->addHtml( '</ul>' );
 136+
 137+ $wgOut->addWikiText( '== '.wfMsg( 'poll-list-old' ).' ==' );
 138+ $wgOut->addHtml( Xml::openElement( 'table' ) );
 139+ $wgOut->addHtml( '<tr><th>'.wfMsg( 'poll-question' ).'</th><th>'.wfMsg( 'poll-dis' ).'</th><th>&nbsp;</th></tr>' );
 140+
 141+ while( $row = $dbr->fetchObject( $query ) ) {
 142+ $wgOut->addHtml( '<tr><td><a href="'.$this->getTitle()->getFullURL( 'action=score&id='.$row->id ).'">'.htmlentities( $row->question, ENT_QUOTES, "UTF-8" ).'</a></td>' );
 143+ $wgOut->addHtml( '<td>'.htmlentities( $row->dis, ENT_QUOTES, "UTF-8" ).'</td>' );
 144+ }
 145+
 146+ $wgOut->addHtml( Xml::closeElement( 'table' ) );
 147+
 148+ }
 149+
78150 // This function create a interface for create new polls
79151 public function create() {
80152 global $wgOut, $wgUser;
@@ -100,6 +172,14 @@
101173 $wgOut->addHtml( '<tr><td>'.wfMsg( 'poll-alternative' ).' 5:</td><td>'.Xml::input('poll_alternative_5').'</td></tr>' );
102174 $wgOut->addHtml( '<tr><td>'.wfMsg( 'poll-alternative' ).' 6:</td><td>'.Xml::input('poll_alternative_6').'</td></tr>' );
103175 $wgOut->addHtml( '<tr><td>'.wfMsg( 'poll-dis' ).':</td><td>'.Xml::textarea('dis', '').'</td></tr>' );
 176+ $wgOut->addHtml( '<tr><td>'.wfMsg( 'poll-runtime' ).'</td><td><select name="runtime" size="1">' );
 177+ $wgOut->addHtml( Xml::option( wfMsg( 'poll-runtime-1-day' ), 86400 ) );
 178+ $wgOut->addHtml( Xml::option( wfMsg( 'poll-runtime-2-days' ), 172800 ) );
 179+ $wgOut->addHtml( Xml::option( wfMsg( 'poll-runtime-1-week' ), 604800 ) );
 180+ $wgOut->addHtml( Xml::option( wfMsg( 'poll-runtime-2-weeks' ), 1209600 ) );
 181+ $wgOut->addHtml( Xml::option( wfMsg( 'poll-runtime-3-weeks' ), 1814400 ) );
 182+ $wgOut->addHtml( Xml::option( wfMsg( 'poll-runtime-4-weeks' ), 2419200 ) );
 183+ $wgOut->addHtml( '</select></td></tr>' );
104184 $wgOut->addHtml( Xml::closeElement( 'table' ) );
105185 $wgOut->addHtml( Xml::check('allow_more').' '.wfMsg( 'poll-create-allow-more' ).'<br />' );
106186 $wgOut->addHtml( Xml::check('allow_ip', $ip_checked).' '.wfMsg( 'poll-create-allow-ip' ).'<br />' );
@@ -175,98 +255,104 @@
176256
177257 // This function create a score for the polls
178258 public function score( $sid ) {
179 - global $wgOut;
 259+ global $wgOut, $wgUser;
180260
181261 $wgOut->setPagetitle( wfMsg( 'poll-title-score' ) );
182 -
183 - $dbr = wfGetDB( DB_SLAVE );
184 - $query = $dbr->select( 'poll', 'question, alternative_1, alternative_2, alternative_3, alternative_4, alternative_5, alternative_6, creater, multi', array( 'id' => $sid ) );
185 -
186 - while( $row = $dbr->fetchObject( $query ) ) {
187 - $question = htmlentities( $row->question, ENT_QUOTES, 'UTF-8' );
188 - $alternative_1 = htmlentities( $row->alternative_1, ENT_QUOTES, 'UTF-8' );
189 - $alternative_2 = htmlentities( $row->alternative_2, ENT_QUOTES, 'UTF-8' );
190 - $alternative_3 = htmlentities( $row->alternative_3, ENT_QUOTES, 'UTF-8' );
191 - $alternative_4 = htmlentities( $row->alternative_4, ENT_QUOTES, 'UTF-8' );
192 - $alternative_5 = htmlentities( $row->alternative_5, ENT_QUOTES, 'UTF-8' );
193 - $alternative_6 = htmlentities( $row->alternative_6, ENT_QUOTES, 'UTF-8' );
194 - $creater = htmlentities( $row->creater, ENT_QUOTES, 'UTF-8' );
195 - $multi = $row->multi;
196 - }
197262
198 - if( !isset($question) OR $question == "" ) {
199 - $wgOut->addWikiMsg( 'poll-invalid-id' );
 263+ if ( !$wgUser->isAllowed( 'poll-score' ) ) {
 264+ $wgOut->addWikiMsg( 'poll-score-right-error' );
200265 $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
201 - return;
202266 }
 267+ else {
 268+ $dbr = wfGetDB( DB_SLAVE );
 269+ $query = $dbr->select( 'poll', 'question, alternative_1, alternative_2, alternative_3, alternative_4, alternative_5, alternative_6, creater, multi', array( 'id' => $sid ) );
 270+
 271+ while( $row = $dbr->fetchObject( $query ) ) {
 272+ $question = htmlentities( $row->question, ENT_QUOTES, 'UTF-8' );
 273+ $alternative_1 = htmlentities( $row->alternative_1, ENT_QUOTES, 'UTF-8' );
 274+ $alternative_2 = htmlentities( $row->alternative_2, ENT_QUOTES, 'UTF-8' );
 275+ $alternative_3 = htmlentities( $row->alternative_3, ENT_QUOTES, 'UTF-8' );
 276+ $alternative_4 = htmlentities( $row->alternative_4, ENT_QUOTES, 'UTF-8' );
 277+ $alternative_5 = htmlentities( $row->alternative_5, ENT_QUOTES, 'UTF-8' );
 278+ $alternative_6 = htmlentities( $row->alternative_6, ENT_QUOTES, 'UTF-8' );
 279+ $creater = htmlentities( $row->creater, ENT_QUOTES, 'UTF-8' );
 280+ $multi = $row->multi;
 281+ }
203282
204 - if($multi != 1) {
205 - $query_1 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '1', 'pid' => $sid ) );
206 - $query_2 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '2', 'pid' => $sid ) );
207 - $query_3 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '3', 'pid' => $sid ) );
208 - $query_4 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '4', 'pid' => $sid ) );
209 - $query_5 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '5', 'pid' => $sid ) );
210 - $query_6 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '6', 'pid' => $sid ) );
 283+ if( !isset($question) OR $question == "" ) {
 284+ $wgOut->addWikiMsg( 'poll-invalid-id' );
 285+ $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
 286+ return;
 287+ }
 288+
 289+ if($multi != 1) {
 290+ $query_1 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '1', 'pid' => $sid ) );
 291+ $query_2 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '2', 'pid' => $sid ) );
 292+ $query_3 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '3', 'pid' => $sid ) );
 293+ $query_4 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '4', 'pid' => $sid ) );
 294+ $query_5 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '5', 'pid' => $sid ) );
 295+ $query_6 = $dbr->select( 'poll_answer', 'uid', array( 'vote' => '6', 'pid' => $sid ) );
211296
212 - $query_num_1 = $dbr->numRows( $query_1 );
213 - $query_num_2 = $dbr->numRows( $query_2 );
214 - $query_num_3 = $dbr->numRows( $query_3 );
215 - $query_num_4 = $dbr->numRows( $query_4 );
216 - $query_num_5 = $dbr->numRows( $query_5 );
217 - $query_num_6 = $dbr->numRows( $query_6 );
218 - }
 297+ $query_num_1 = $dbr->numRows( $query_1 );
 298+ $query_num_2 = $dbr->numRows( $query_2 );
 299+ $query_num_3 = $dbr->numRows( $query_3 );
 300+ $query_num_4 = $dbr->numRows( $query_4 );
 301+ $query_num_5 = $dbr->numRows( $query_5 );
 302+ $query_num_6 = $dbr->numRows( $query_6 );
 303+ }
219304
220 - if($multi == 1) {
221 - $query_num_1 = 0;
222 - $query_num_2 = 0;
223 - $query_num_3 = 0;
224 - $query_num_4 = 0;
225 - $query_num_5 = 0;
226 - $query_num_6 = 0;
 305+ if($multi == 1) {
 306+ $query_num_1 = 0;
 307+ $query_num_2 = 0;
 308+ $query_num_3 = 0;
 309+ $query_num_4 = 0;
 310+ $query_num_5 = 0;
 311+ $query_num_6 = 0;
227312
228 - $query_multi = $dbr->select( 'poll_answer', 'vote', array( 'pid' => $sid ) );
229 - while( $row = $dbr->fetchObject( $query_multi ) ) {
230 - $vote = $row->vote;
231 - $vote = explode("|", $vote);
 313+ $query_multi = $dbr->select( 'poll_answer', 'vote', array( 'pid' => $sid ) );
 314+ while( $row = $dbr->fetchObject( $query_multi ) ) {
 315+ $vote = $row->vote;
 316+ $vote = explode("|", $vote);
232317
233 - if($vote[0] == "1") { $query_num_1++; }
234 - if($vote[1] == "1") { $query_num_2++; }
235 - if($vote[2] == "1") { $query_num_3++; }
236 - if($vote[3] == "1") { $query_num_4++; }
237 - if($vote[4] == "1") { $query_num_5++; }
238 - if($vote[5] == "1") { $query_num_6++; }
 318+ if($vote[0] == "1") { $query_num_1++; }
 319+ if($vote[1] == "1") { $query_num_2++; }
 320+ if($vote[2] == "1") { $query_num_3++; }
 321+ if($vote[3] == "1") { $query_num_4++; }
 322+ if($vote[4] == "1") { $query_num_5++; }
 323+ if($vote[5] == "1") { $query_num_6++; }
 324+ }
239325 }
240 - }
241326
242 - $query_other = $dbr->select( 'poll_answer', 'vote_other', array( 'pid' => $sid, 'isset_vote_other' => 1 ) );
243 - $score_other = array( );
244 - while( $row = $dbr->fetchObject( $query_other ) ) {
245 - if( !isset($score_other[$row->vote_other]['first']) ) {
246 - $score_other[$row->vote_other]['first'] = 0;
247 - $score_other[$row->vote_other]['number'] = 1;
248 - continue;
 327+ $query_other = $dbr->select( 'poll_answer', 'vote_other', array( 'pid' => $sid, 'isset_vote_other' => 1 ) );
 328+ $score_other = array( );
 329+ while( $row = $dbr->fetchObject( $query_other ) ) {
 330+ if( !isset($score_other[$row->vote_other]['first']) ) {
 331+ $score_other[$row->vote_other]['first'] = 0;
 332+ $score_other[$row->vote_other]['number'] = 1;
 333+ continue;
 334+ }
 335+ $score_other[$row->vote_other]['number']++;
249336 }
250 - $score_other[$row->vote_other]['number']++;
 337+ $score_other_out = "";
 338+ foreach($score_other as $name => $value) {
 339+ $score_other_out .= '<tr><td>'.htmlentities( $name, ENT_QUOTES, 'UTF-8' ).'</td><td>'.htmlentities( $value['number'], ENT_QUOTES, 'UTF-8' ).'</td></tr>';
 340+ }
 341+
 342+ $wgOut->addHtml( Xml::openElement( 'table' ) );
 343+ $wgOut->addHtml( '<tr><th><center>'.$question.'</center></th></tr>' );;
 344+ $wgOut->addHtml( '<tr><td>'.$alternative_1.'</td><td>'.$query_num_1.'</td></tr>' );
 345+ $wgOut->addHtml( '<tr><td>'.$alternative_2.'</td><td>'.$query_num_2.'</td></tr>' );
 346+ if($alternative_3 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_3.'</td><td>'.$query_num_3.'</td></tr>' ); }
 347+ if($alternative_4 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_4.'</td><td>'.$query_num_4.'</td></tr>' ); }
 348+ if($alternative_5 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_5.'</td><td>'.$query_num_5.'</td></tr>' ); }
 349+ if($alternative_6 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_6.'</td><td>'.$query_num_6.'</td></tr>' ); }
 350+ if($score_other_out != "") { $wgOut->addHtml( '<tr><td colspan="2">'.wfMsg( 'poll-vote-other' ).' </td></tr>'. $score_other_out ); }
 351+ $wgOut->addHtml( '<tr><td>' );
 352+ $wgOut->addWikiText( '<small>'.wfMsg( 'poll-score-created', $creater ).'</small>' );
 353+ $wgOut->addHtml( '</td></tr>' );
 354+ $wgOut->addHtml( Xml::closeElement( 'table' ) );
 355+ $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
251356 }
252 - $score_other_out = "";
253 - foreach($score_other as $name => $value) {
254 - $score_other_out .= '<tr><td>'.htmlentities( $name, ENT_QUOTES, 'UTF-8' ).'</td><td>'.htmlentities( $value['number'], ENT_QUOTES, 'UTF-8' ).'</td></tr>';
255 - }
256 -
257 - $wgOut->addHtml( Xml::openElement( 'table' ) );
258 - $wgOut->addHtml( '<tr><th><center>'.$question.'</center></th></tr>' );;
259 - $wgOut->addHtml( '<tr><td>'.$alternative_1.'</td><td>'.$query_num_1.'</td></tr>' );
260 - $wgOut->addHtml( '<tr><td>'.$alternative_2.'</td><td>'.$query_num_2.'</td></tr>' );
261 - if($alternative_3 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_3.'</td><td>'.$query_num_3.'</td></tr>' ); }
262 - if($alternative_4 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_4.'</td><td>'.$query_num_4.'</td></tr>' ); }
263 - if($alternative_5 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_5.'</td><td>'.$query_num_5.'</td></tr>' ); }
264 - if($alternative_6 != "") { $wgOut->addHtml( '<tr><td>'.$alternative_6.'</td><td>'.$query_num_6.'</td></tr>' ); }
265 - if($score_other_out != "") { $wgOut->addHtml( '<tr><td colspan="2">'.wfMsg( 'poll-vote-other' ).' </td></tr>'. $score_other_out ); }
266 - $wgOut->addHtml( '<tr><td>' );
267 - $wgOut->addWikiText( '<small>'.wfMsg( 'poll-score-created', $creater ).'</small>' );
268 - $wgOut->addHtml( '</td></tr>' );
269 - $wgOut->addHtml( Xml::closeElement( 'table' ) );
270 - $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
271357 }
272358
273359 // This function create a interfache for deleting polls
@@ -378,11 +464,13 @@
379465 $multi = ($wgRequest->getVal( 'allow_more' ) == 1)? 1 : 0;
380466 $user = $wgUser->getName();
381467 $ip = ($wgRequest->getVal( 'allow_ip' ) == 1)? 1 : 0;
 468+ $runtime = $wgRequest->getVal('runtime');
382469
383470 if($question != "" && $alternative_1 != "" && $alternative_2 != "") {
384471 $dbw->insert( 'poll', array( 'question' => $question, 'alternative_1' => $alternative_1, 'alternative_2' => $alternative_2,
385472 'alternative_3' => $alternative_3, 'alternative_4' => $alternative_4, 'alternative_5' => $alternative_5,
386 - 'alternative_6' => $alternative_6, 'creater' => $user, 'dis' => $dis, 'multi' => $multi, 'ip' => $ip ) );
 473+ 'alternative_6' => $alternative_6, 'creater' => $user, 'dis' => $dis, 'multi' => $multi, 'ip' => $ip,
 474+ 'starttime' => time(), 'runtime' => $runtime ) );
387475
388476 $log = new LogPage( "poll" );
389477 $title = $this->getTitle();
@@ -422,12 +510,12 @@
423511 }
424512
425513 if($ip == 1) {
426 - $query = $dbw->select( 'poll_answer', 'uid', array( 'uid' => $uid, 'pid' => $pid, 'ip' => $user ));
427 - $num = $dbw->numRows( $query );
 514+ $query = $dbr->select( 'poll_answer', 'uid', array( 'uid' => $uid, 'pid' => $pid, 'ip' => $user ));
 515+ $num = $dbr->numRows( $query );
428516 }
429517 else {
430 - $query = $dbw->select( 'poll_answer', 'uid', array( 'uid' => $uid, 'pid' => $pid ));
431 - $num = $dbw->numRows( $query );
 518+ $query = $dbr->select( 'poll_answer', 'uid', array( 'uid' => $uid, 'pid' => $pid ));
 519+ $num = $dbr->numRows( $query );
432520 }
433521
434522 if($multi != 1) {
Index: trunk/extensions/Poll/Poll.i18n.php
@@ -19,15 +19,17 @@
2020 'poll-title-score' => 'Score',
2121 'poll-create-right-error' => 'You are not allowed to create a new poll(needed right: poll-create)',
2222 'poll-vote-right-error' => 'You are not allowed to vote(needed right: poll-vote)',
 23+ 'poll-score-right-error' => 'You are not allowed to view the score(needed right: poll-score)',
2324 'poll-alternative' => 'Alternative',
2425 'poll-question' => 'Question',
2526 'poll-submit' => 'Submit',
2627 'right-poll-create' => 'Create Poll',
2728 'right-poll-vote' => 'Vote by a Poll',
2829 'right-poll-admin' => 'Manage the Polls',
 30+ 'right-poll-score' => 'View the score of the Polls',
2931 'poll-create-fields-error' => 'The fields Question, Alternative 1 and Alternative 2 must be set',
3032 'poll-dis' => 'Description',
31 - 'poll-list-current' => '== Current Polls ==',
 33+ 'poll-list-current' => 'Current Polls',
3234 'poll-create-pass' => 'Poll created!',
3335 'poll-vote-pass' => 'Voted!',
3436 'poll-vote-already-error' => 'You has already voted!',
@@ -60,7 +62,15 @@
6163 'poll-vote-other' => 'Other answers:',
6264 'poll-ip-error' => 'Unregistered person can not vote at this poll!',
6365 'poll-create-allow-ip' => 'Allow unregistered users to vote',
64 - 'poll-vote-error-ip-change' => 'Unregistered users can not change his vote!',
 66+ 'poll-vote-error-ip-change' => 'Someone has already voted with your IP and unregistered users can not change his vote!',
 67+ 'poll-runtime' => 'Runtime:',
 68+ 'poll-runtime-1-day' => '1 Day',
 69+ 'poll-runtime-2-days' => '2 Days',
 70+ 'poll-runtime-1-week' => '1 Week',
 71+ 'poll-runtime-2-weeks' => '2 Weeks',
 72+ 'poll-runtime-3-weeks' => '3 Weeks',
 73+ 'poll-runtime-4-weeks' => '4 Weeks',
 74+ 'poll-list-old' => 'Old Polls',
6575 );
6676
6777 /** German (Deutsch)
@@ -74,15 +84,17 @@
7585 'poll-title-score' => 'Auswertung',
7686 'poll-create-right-error' => 'Leider darfst du keine neue Umfrage erstellen(benötige Gruppenberechttigung: poll-create)',
7787 'poll-vote-right-error' => 'Leider darfst du nicht abstimmen(benötige Gruppenberechttigung: poll-vote)',
 88+ 'poll-score-right-error' => 'Leider darfst du nicht die Auswertung betrachten(benötige Gruppenberechttigung: poll-score)',
7889 'poll-alternative' => 'Antwortmöglichkeit',
7990 'poll-question' => 'Frage',
8091 'poll-submit' => 'Absenden',
8192 'right-poll-create' => 'Umfrage erstellen',
8293 'right-poll-vote' => 'Bei einer Umfrage abstimmen',
8394 'right-poll-admin' => 'Umfragen verwalten',
 95+ 'right-poll-score' => 'Auswertung der Umfragen betrachten',
8496 'poll-create-fields-error' => 'Die Felder Frage, Antwortmöglichkeit 1 sowie Antwortmöglichkeit 2 müssen ausgefüllt sein',
8597 'poll-dis' => 'Beschreibung',
86 - 'poll-list-current' => '== Aktuelle Umfragen ==',
 98+ 'poll-list-current' => 'Aktuelle Umfragen',
8799 'poll-create-pass' => 'Umfrage erfolgreich erstellt!',
88100 'poll-vote-pass' => 'Erfolgreich abgestimmt!',
89101 'poll-vote-already-error' => 'Du hast bereits abgestimmt!',
@@ -115,5 +127,13 @@
116128 'poll-vote-other' => 'Andere Antworten:',
117129 'poll-ip-error' => 'Nicht registrierte Benutzer können bei dieser Umfrage nicht abstimmen!',
118130 'poll-create-allow-ip' => 'Erlaube nicht registrierten Benutzer abzustimmen',
119 - 'poll-vote-error-ip-change' => 'Leider können nicht registrierten Benutzer ihr Stimme nicht nachträglich ändern!',
 131+ 'poll-vote-error-ip-change' => 'Ihre Stimme wurde nicht gezählt, da mit Ihrer IP-Adresse wurde bereits eine Stimme abgegeben wurde und nicht registierte Benutzer ihre Stimme nicht nachträglich ändern dürfen.',
 132+ 'poll-runtime' => 'Laufzeit:',
 133+ 'poll-runtime-1-day' => '1 Tag',
 134+ 'poll-runtime-2-days' => '2 Tage',
 135+ 'poll-runtime-1-week' => '1 Woche',
 136+ 'poll-runtime-2-weeks' => '2 Wochen',
 137+ 'poll-runtime-3-weeks' => '3 Wochen',
 138+ 'poll-runtime-4-weeks' => '4 Wochen',
 139+ 'poll-list-old' => 'Alte Umfragen',
120140 );
Index: trunk/extensions/Poll/Poll.php
@@ -48,6 +48,10 @@
4949 $wgGroupPermissions['*']['poll-vote'] = false;
5050 $wgAvailableRights[] = 'poll-vote';
5151
 52+// New right: poll-score
 53+$wgGroupPermissions['*']['poll-score'] = true;
 54+$wgAvailableRights[] = 'poll-score';
 55+
5256 $dir = dirname( __FILE__ ) . '/';
5357
5458 // Infomation about the Special Page "Poll"
@@ -82,6 +86,9 @@
8387 $wgExtNewFields[] = array( 'poll_answer', 'user', "$base/archives/patch-user.sql" ); // Add user
8488 $wgExtNewFields[] = array( 'poll_answer', 'vote_other', "$base/archives/patch-vote_other.sql" ); // Add vote_other
8589 $wgExtNewFields[] = array( 'poll_answer', 'ip', "$base/archives/patch-answer-ip.sql" ); // Add ip
 90+
 91+ // "poll_start_log"-Table: Time with last run of Poll::start()
 92+ $wgExtNewTables[] = array( 'poll_start_log', "$base/archives/Poll-start-log.sql" ); // Initial start_log tables
8693 }
8794 return true;
8895 }

Status & tagging log