r113555 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113554‎ | r113555 | r113556 >
Date:11:36, 10 March 2012
Author:wikinaut
Status:new
Tags:
Comment:
follow up r113554 . forgot - and fixed now - the server-side check of the ajaxpoll-vote permission. For viewers without voting permission it does not make sense to check one of the radio buttons, buttons are now unchecked on load.
Modified paths:
  • /trunk/extensions/AJAXPoll/AJAXPoll.php (modified) (history)
  • /trunk/extensions/AJAXPoll/AJAXPoll_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AJAXPoll/AJAXPoll.php
@@ -19,7 +19,7 @@
2020 * @author Jack Phoenix <jack@countervandalism.net>
2121 * @author Thomas Gries
2222 * @maintainer Thomas Gries
23 - * @version 1.62
 23+ * @version 1.63
2424 * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
2525 */
2626
@@ -31,7 +31,7 @@
3232 $wgExtensionCredits['parserhook'][] = array(
3333 'path' => __FILE__,
3434 'name' => 'AJAX Poll',
35 - 'version' => '1.62 20120310',
 35+ 'version' => '1.63 20120310',
3636 'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
3737 'descriptionmsg' => 'ajaxpoll-desc',
3838 'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
@@ -48,7 +48,7 @@
4949 $wgAvailableRights[] = 'ajaxpoll-vote';
5050
5151 # default: everyone can vote
52 -$wgGroupPermissions['*']['ajaxpoll-vote'] = true;
 52+$wgGroupPermissions['*']['ajaxpoll-vote'] = false;
5353 # if you want only users to vote use
5454 # $wgGroupPermissions['user']['ajaxpoll-vote'] = true;
5555
Index: trunk/extensions/AJAXPoll/AJAXPoll_body.php
@@ -160,7 +160,7 @@
161161 $user = $wgUser->getName();
162162 }
163163
164 - if ( $wgUser->isAllowed( 'bot' ) ) {
 164+ if ( !$wgUser->isAllowed( 'ajaxpoll-vote' ) || $wgUser->isAllowed( 'bot' ) ) {
165165 return AJAXPoll::buildHTML( $ID, $user );
166166 }
167167
@@ -348,7 +348,7 @@
349349 } else {
350350
351351 $ret .= "
352 -<div id='ajaxpoll-answer-" . $ans_no . "' class='ajaxpoll-answer'><div class='ajaxpoll-answer-name'><label for='ajaxpoll-post-answer-" . $ans_no . "' onclick='$(\"#ajaxpoll-ajax-" . $ID . "\").html(\"" . wfMsg( 'ajaxpoll-vote-permission' ) . "\");$(\"#ajaxpoll-ajax-" . $ID . "\").css(\"display\",\"block\");'><input disabled='disabled' type='radio' id='ajaxpoll-post-answer-" . $ans_no . "' name='ajaxpoll-post-answer-" . $ans_no . "' value='" . $i . "'" . ( $our ? 'checked=true ' : '' ) . "/>" . strip_tags( $lines[$i] ) .
 352+<div id='ajaxpoll-answer-" . $ans_no . "' class='ajaxpoll-answer'><div class='ajaxpoll-answer-name'><label for='ajaxpoll-post-answer-" . $ans_no . "' onclick='$(\"#ajaxpoll-ajax-" . $ID . "\").html(\"" . wfMsg( 'ajaxpoll-vote-permission' ) . "\");$(\"#ajaxpoll-ajax-" . $ID . "\").css(\"display\",\"block\");'><input disabled='disabled' type='radio' id='ajaxpoll-post-answer-" . $ans_no . "' name='ajaxpoll-post-answer-" . $ans_no . "' value='" . $i . "'/>" . strip_tags( $lines[$i] ) .
353353 "</label></div><div class='ajaxpoll-answer-vote" . ( $our ? ' ajaxpoll-our-vote' : '' ) ."' onmouseover='mover(this)' onmouseout='mout(this);'><span title='" . wfMsg( 'ajaxpoll-percent-votes', sprintf( $percent ) ) . "'>" . ( ( isset( $poll_result ) && !empty( $poll_result[$i + 1] ) ) ? $poll_result[$i + 1] : 0 ) . "</span><div style='width: " . $percent . "%;" . ( $percent == 0 ? ' border:0;' : '' ) . "'></div></div>
354354 </div>
355355 ";

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113554fix enhancement bug35118 . add new user right ajaxpoll-votewikinaut09:26, 10 March 2012

Status & tagging log