http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89023
Revision: 89023
Author: werdna
Date: 2011-05-28 07:49:04 +0000 (Sat, 28 May 2011)
Log Message:
-----------
Merge r89020
Modified Paths:
--------------
branches/wmf/1.17wmf1/extensions/SecurePoll/SecurePoll.i18n.php
branches/wmf/1.17wmf1/extensions/SecurePoll/includes/entities/Election.php
branches/wmf/1.17wmf1/extensions/SecurePoll/includes/user/Auth.php
Property Changed:
----------------
branches/wmf/1.17wmf1/extensions/SecurePoll/
Property changes on: branches/wmf/1.17wmf1/extensions/SecurePoll
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/REL1_15/phase3/extensions/SecurePoll:51646
/branches/new-installer/phase3/extensions/SecurePoll:43664-66004
/branches/sqlite/extensions/SecurePoll:58211-58321
/branches/wmf/1.16wmf4/extensions/SecurePoll:67177,69199,76243,77266
/branches/wmf-deployment/extensions/SecurePoll:60970
/trunk/extensions/SecurePoll:89020
/trunk/phase3/extensions/SecurePoll:79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,80406,81833,83212,83590
Modified: branches/wmf/1.17wmf1/extensions/SecurePoll/SecurePoll.i18n.php
===================================================================
--- branches/wmf/1.17wmf1/extensions/SecurePoll/SecurePoll.i18n.php
2011-05-28 07:41:25 UTC (rev 89022)
+++ branches/wmf/1.17wmf1/extensions/SecurePoll/SecurePoll.i18n.php
2011-05-28 07:49:04 UTC (rev 89023)
@@ -75,6 +75,7 @@
'securepoll-not-logged-in' => 'You must log in to vote in this
election',
'securepoll-too-few-edits' => 'Sorry, you cannot vote. You need to have
made at least $1 {{PLURAL:$1|edit|edits}} to vote in this election, you have
made $2.',
'securepoll-blocked' => 'Sorry, you cannot vote in this election if you
are currently blocked from editing.',
+ 'securepoll-blocked-centrally' => 'Sorry, you cannot vote in this
election if you are blocked on $1 or more {{PLURAL:$1|wiki|wikis}}.',
'securepoll-bot' => 'Sorry, accounts with the bot flag are not allowed
to vote in this election.',
'securepoll-not-in-group' => 'Only members of the "$1" group can vote
in this election.',
'securepoll-not-in-list' => 'Sorry, you are not in the predetermined
list of users authorised to vote in this election.',
Modified:
branches/wmf/1.17wmf1/extensions/SecurePoll/includes/entities/Election.php
===================================================================
--- branches/wmf/1.17wmf1/extensions/SecurePoll/includes/entities/Election.php
2011-05-28 07:41:25 UTC (rev 89022)
+++ branches/wmf/1.17wmf1/extensions/SecurePoll/includes/entities/Election.php
2011-05-28 07:49:04 UTC (rev 89023)
@@ -31,6 +31,10 @@
* True if a voter is not allowed to change their vote
* encrypt-type
* The encryption module name
+ * not-centrally-blocked
+ * True if voters need to not be blocked on more than X projects
+ * central-block-threshold
+ * Number of blocks across projects that disqualify a user from
voting.
*
* See the other module for documentation of the following.
*
@@ -169,6 +173,14 @@
if ( $notBlocked && $isBlocked ) {
$status->fatal( 'securepoll-blocked' );
}
+
+ # Centrally blocked on more than X projects
+ $notCentrallyBlocked = $this->getProperty(
'not-centrally-blocked' );
+ $centralBlockCount = isset( $props['central-block-count'] ) ?
$props['central-block-count'] : 0;
+ $centralBlockThreshold = $this->getProperty(
'central-block-threshold', 1 );
+ if ( $centralBlockCount >= $centralBlockThreshold ) {
+ $status->fatal( 'securepoll-blocked-centrally',
$centralBlockThreshold );
+ }
# Bot
$notBot = $this->getProperty( 'not-bot' );
@@ -198,6 +210,7 @@
$status = Status::newFatal(
'securepoll-custom-unqualified', $errorMsg );
}
}
+
return $status;
}
Modified: branches/wmf/1.17wmf1/extensions/SecurePoll/includes/user/Auth.php
===================================================================
--- branches/wmf/1.17wmf1/extensions/SecurePoll/includes/user/Auth.php
2011-05-28 07:41:25 UTC (rev 89022)
+++ branches/wmf/1.17wmf1/extensions/SecurePoll/includes/user/Auth.php
2011-05-28 07:49:04 UTC (rev 89023)
@@ -209,6 +209,7 @@
'properties' => array(
'wiki' => wfWikiID(),
'blocked' => $user->isBlocked(),
+ 'central-block-count' =>
$this->getCentralBlockCount( $user ),
'edit-count' => $user->getEditCount(),
'bot' => $user->isAllowed( 'bot' ),
'language' => $user->getOption( 'language' ),
@@ -216,6 +217,7 @@
'lists' => $this->getLists( $user )
)
);
+
wfRunHooks( 'SecurePoll_GetUserParams', array( $this, $user,
&$params ) );
return $params;
}
@@ -239,6 +241,30 @@
}
return $lists;
}
+
+ /**
+ * Checks how many central wikis the user is blocked on
+ * @param $user User
+ * @return Integer the number of wikis the user is blocked on.
+ */
+ function getCentralBlockCount( $user ) {
+ if ( ! class_exists( 'CentralAuthUser' ) ) {
+ return 0;
+ }
+
+ $centralUser = new CentralAuthUser( $user );
+
+ $attached = $centralUser->queryAttached();
+ $blockCount = 0;
+
+ foreach( $attached as $wiki => $data ) {
+ if ( $data['blocked'] ) {
+ $blockCount++;
+ }
+ }
+
+ return $blockCount;
+ }
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs