r48954 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48953‎ | r48954 | r48955 >
Date:10:10, 28 March 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* trailing whitespace removed
* stylize.php
Modified paths:
  • /trunk/extensions/AjaxLogin/AjaxLogin.php (modified) (history)
  • /trunk/extensions/AjaxLogin/ApiAjaxLogin.php (modified) (history)
  • /trunk/extensions/SecurePoll/GoToBoardVote_body.php (modified) (history)
  • /trunk/extensions/SecurePoll/SecurePoll.i18n.php (modified) (history)
  • /trunk/extensions/SecurePoll/SecurePoll.php (modified) (history)
  • /trunk/extensions/SecurePoll/SecurePoll_body.php (modified) (history)
  • /trunk/extensions/SecurePoll/cacert-both.crt (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Auth.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Ballot.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Crypt.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Election.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Entity.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Option.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Page.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Question.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/User.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/VotePage.php (modified) (history)
  • /trunk/extensions/SecurePoll/tally.php (modified) (history)
  • /trunk/extensions/SecurePoll/voterList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AjaxLogin/AjaxLogin.php
@@ -10,7 +10,7 @@
1111 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1212 */
1313
14 -if( !defined( 'MEDIAWIKI' ) ){
 14+if ( !defined( 'MEDIAWIKI' ) ) {
1515 die( "This is not a valid entry point.\n" );
1616 }
1717
@@ -45,7 +45,7 @@
4646
4747 /**
4848 * Adds required JavaScript & CSS files to the HTML output of a page if AjaxLogin is enabled
49 - *
 49+ *
5050 * @param $out OutputPage object
5151 * @return true
5252 */
@@ -53,15 +53,15 @@
5454 global $wgEnableAjaxLogin, $wgScriptPath, $wgJsMimeType;
5555
5656 # Don't load anything if AjaxLogin isn't enabled
57 - if( !isset( $wgEnableAjaxLogin ) ) {
 57+ if ( !isset( $wgEnableAjaxLogin ) ) {
5858 return true;
5959 }
6060
6161 // YUI library dependencies
6262 // Utilities.js -- contains all stuff required by AjaxLogin and a tad bit more...
63 - $out->addScript('<script language="javascript" type="'. $wgJsMimeType .'" src="http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"></script>'."\n");
 63+ $out->addScript( '<script language="javascript" type="' . $wgJsMimeType . '" src="http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"></script>' . "\n" );
6464 // DragDrop
65 - $out->addScript('<script language="javascript" type="'. $wgJsMimeType .'" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>'."\n");
 65+ $out->addScript( '<script language="javascript" type="' . $wgJsMimeType . '" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>' . "\n" );
6666 // YUI styles -- these introduce some CSS warnings when included...
6767 $out->addExtensionStyle( 'http://yui.yahooapis.com/2.7.0/build/container/assets/container.css' );
6868 $out->addExtensionStyle( 'http://yui.yahooapis.com/2.7.0/build/container/assets/container-core.css' );
@@ -80,11 +80,11 @@
8181 * @param $vars Variables to be added
8282 * @return true
8383 */
84 -function efAddAjaxLoginVariables( $vars ){
 84+function efAddAjaxLoginVariables( $vars ) {
8585 global $wgEnableAjaxLogin;
8686
8787 $vars['wgEnableAjaxLogin'] = ( is_array( $wgEnableAjaxLogin ) ) ? in_array( $vars['skin'], $wgEnableAjaxLogin ) : false;
88 - if( $vars['wgIsArticle'] == false && $vars['wgEnableAjaxLogin'] ) {
 88+ if ( $vars['wgIsArticle'] == false && $vars['wgEnableAjaxLogin'] ) {
8989 wfLoadExtensionMessages( 'AjaxLogin' );
9090 $vars['ajaxLogin1'] = wfMsg( 'ajaxLogin1' );
9191 $vars['ajaxLogin2'] = wfMsg( 'ajaxLogin2' );
@@ -101,37 +101,37 @@
102102 */
103103 function GetAjaxLoginForm( &$data ) {
104104 global $wgAuth, $wgEnableEmail, $wgOut, $wgTitle, $wgUser;
105 - if( $wgUser->isAnon() && $wgTitle->getNamespace() != 8 && $wgTitle->getDBkey() != 'Userlogin' ) {
 105+ if ( $wgUser->isAnon() && $wgTitle->getNamespace() != 8 && $wgTitle->getDBkey() != 'Userlogin' ) {
106106 $titleObj = SpecialPage::getTitleFor( 'Userlogin' );
107107 $link = $titleObj->getLocalUrl( 'type=signup' );
108 - $wgOut->addHTML('<!--[if lt IE 9]><style type="text/css">#userloginRound { width: 350px !important; }</style><![endif]-->
 108+ $wgOut->addHTML( '<!--[if lt IE 9]><style type="text/css">#userloginRound { width: 350px !important; }</style><![endif]-->
109109 <div id="userloginRound" class="roundedDiv yui-module yui-overlay yui-panel" style="display:none; background:none; border:none;">
110110 <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
111111 <div class="r_boxContent">
112 - <div class="boxHeader color1">'. wfMsg( 'login' ) .'</div>
 112+ <div class="boxHeader color1">' . wfMsg( 'login' ) . '</div>
113113 <form action="" method="post" name="userajaxloginform" id="userajaxloginform" style="margin:5px">
114114 <div id="wpError" style="width: 250px; line-height: 1.4em"></div>
115 - <label for="wpName1">'. wfMsg( 'yourname' ) .'</label><br />
 115+ <label for="wpName1">' . wfMsg( 'yourname' ) . '</label><br />
116116 <input type="text" class="loginText" name="wpName" id="wpName1" tabindex="101" size="20" /><br />
117 - <label for="wpPassword1">'. wfMsg( 'yourpassword' ) .'</label><br />
 117+ <label for="wpPassword1">' . wfMsg( 'yourpassword' ) . '</label><br />
118118 <input type="password" class="loginPassword" name="wpPassword" id="wpPassword1" tabindex="102" size="20" /><br />
119119 <div style="padding-bottom:3px">
120 - <input type="checkbox" name="wpRemember" tabindex="104" value="1" id="wpRemember1"'.( $wgUser->getOption( 'rememberpassword' ) ? ' checked="checked"' : '' ).' />
121 - <label for="wpRemember1">'. wfMsg( 'remembermypassword' ) .'</label><br />
 120+ <input type="checkbox" name="wpRemember" tabindex="104" value="1" id="wpRemember1"' . ( $wgUser->getOption( 'rememberpassword' ) ? ' checked="checked"' : '' ) . ' />
 121+ <label for="wpRemember1">' . wfMsg( 'remembermypassword' ) . '</label><br />
122122 </div>
123 - <input style="margin:0;padding:0 .25em;width:auto;overflow:visible;" type="submit" name="wpLoginattempt" id="wpLoginattempt" tabindex="105" value="'. wfMsg( 'login' ) .'" />'
 123+ <input style="margin:0;padding:0 .25em;width:auto;overflow:visible;" type="submit" name="wpLoginattempt" id="wpLoginattempt" tabindex="105" value="' . wfMsg( 'login' ) . '" />'
124124 );
125 - if( $wgEnableEmail && $wgAuth->allowPasswordChange() ) {
126 - $wgOut->addHTML( '<br /><input style="margin:3px 0;padding:0 .25em;width:auto;overflow:visible;font-size:0.9em" type="submit" name="wpMailmypassword" id="wpMailmypassword" tabindex="106" value="'. wfMsg( 'mailmypassword' ) .'" />' );
 125+ if ( $wgEnableEmail && $wgAuth->allowPasswordChange() ) {
 126+ $wgOut->addHTML( '<br /><input style="margin:3px 0;padding:0 .25em;width:auto;overflow:visible;font-size:0.9em" type="submit" name="wpMailmypassword" id="wpMailmypassword" tabindex="106" value="' . wfMsg( 'mailmypassword' ) . '" />' );
127127 }
128128 // Originally this used core message 'nologinlink' but it wouldn't work too well for Finnish, so I changed it. --Jack Phoenix
129129 wfLoadExtensionMessages( 'AjaxLogin' );
130 - $wgOut->addHTML('<br /><a id="wpAjaxRegister" href="'. htmlspecialchars( $link ) .'">'. wfMsg( 'ajaxlogin-create' ) .'</a>
 130+ $wgOut->addHTML( '<br /><a id="wpAjaxRegister" href="' . htmlspecialchars( $link ) . '">' . wfMsg( 'ajaxlogin-create' ) . '</a>
131131 </form>
132132
133133 </div>
134134 <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>
135 -</div>');
 135+</div>' );
136136 }
137137 return true;
138138 }
\ No newline at end of file
Index: trunk/extensions/AjaxLogin/ApiAjaxLogin.php
@@ -7,7 +7,7 @@
88 * @author Inez Korczyński <korczynski@gmail.com>
99 */
1010
11 -if( !defined( 'MEDIAWIKI' ) ) {
 11+if ( !defined( 'MEDIAWIKI' ) ) {
1212 die( "This is not a valid entry point.\n" );
1313 }
1414
@@ -21,7 +21,7 @@
2222 $Name = $Password = $Remember = $Loginattempt = $Mailmypassword = null;
2323 extract( $this->extractRequestParams() );
2424
25 - if( !empty( $Loginattempt ) ) {
 25+ if ( !empty( $Loginattempt ) ) {
2626 // Login attempt
2727 $params = new FauxRequest(
2828 array(
@@ -80,7 +80,7 @@
8181 $dbw->commit();
8282
8383 $this->getResult()->addValue( null, 'ajaxlogin', $result );
84 - } else if( !empty( $Mailmypassword ) ) {
 84+ } else if ( !empty( $Mailmypassword ) ) {
8585 // Remind password attempt
8686 $params = new FauxRequest(
8787 array(
@@ -90,10 +90,10 @@
9191 $result = array();
9292 $loginForm = new LoginForm( $params );
9393 global $wgUser, $wgOut, $wgAuth;
94 - if( !$wgAuth->allowPasswordChange() ) {
 94+ if ( !$wgAuth->allowPasswordChange() ) {
9595 $result['result'] = 'resetpass_forbidden';
9696 $result['text'] = wfMsg( 'resetpass_forbidden' );
97 - } else if( $wgUser->isBlocked() ) {
 97+ } else if ( $wgUser->isBlocked() ) {
9898 $result['result'] = 'blocked-mailpassword';
9999 $result['text'] = wfMsg( 'blocked-mailpassword' );
100100 } else if ( '' == $loginForm->mName ) {
@@ -101,7 +101,7 @@
102102 $result['text'] = wfMsg( 'noname' );
103103 } else {
104104 $u = User::newFromName( $loginForm->mName );
105 - if( is_null( $u ) ) {
 105+ if ( is_null( $u ) ) {
106106 $result['result'] = 'noname';
107107 $result['text'] = wfMsg( 'noname' );
108108 } else if ( 0 == $u->getID() ) {
@@ -113,7 +113,7 @@
114114 $result['text'] = wfMsg( 'throttled-mailpassword', round( $wgPasswordReminderResendTime, 3 ) );
115115 } else {
116116 $res = $loginForm->mailPasswordInternal( $u, true );
117 - if( WikiError::isError( $res ) ) {
 117+ if ( WikiError::isError( $res ) ) {
118118 $result['result'] = 'mailerror';
119119 $result['text'] = wfMsg( 'mailerror', $res->getMessage() );
120120 } else {
Index: trunk/extensions/SecurePoll/SecurePoll_body.php
@@ -1,5 +1,5 @@
22 <?php
3 -if( !defined('MEDIAWIKI') ) {
 3+if ( !defined( 'MEDIAWIKI' ) ) {
44 die( "Not a valid entry point\n" );
55 }
66
Index: trunk/extensions/SecurePoll/GoToBoardVote_body.php
@@ -1,5 +1,5 @@
22 <?php
3 -if( !defined('MEDIAWIKI') ) {
 3+if ( !defined( 'MEDIAWIKI' ) ) {
44 die( "Not a valid entry point\n" );
55 }
66
@@ -39,7 +39,7 @@
4040 }
4141
4242 if ( $wgUser->isLoggedIn() ) {
43 - #$url = 'http://shimmer/farm/frwiki/index.php?' . wfArrayToCGI( array(
 43+ # $url = 'http://shimmer/farm/frwiki/index.php?' . wfArrayToCGI( array(
4444 $url = 'https://wikimedia.spi-inc.org/index.php?' . wfArrayToCGI( array(
4545 'title' => 'Special:BoardVote' . ( $par ? "/$par" : '' ),
4646 'sid' => session_id(),
Index: trunk/extensions/SecurePoll/SecurePoll.i18n.php
@@ -40,7 +40,7 @@
4141 'securepoll-no-gpg-home' => 'Unable to create GPG home directory.',
4242 'securepoll-secret-gpg-error' => 'Error executing GPG.
4343 Use $wgSecurePollShowErrorDetail=true; in LocalSettings.php to show more detail.',
44 -'securepoll-full-gpg-error' => 'Error executing GPG:
 44+'securepoll-full-gpg-error' => 'Error executing GPG:
4545
4646 Command: $1
4747
@@ -49,5 +49,4 @@
5050 'securepoll-gpg-config-error' => 'GPG keys are configured incorrectly.',
5151 'securepoll-gpg-parse-error' => 'Error interpreting GPG output.',
5252 'securepoll-no-decryption-key' => 'No decryption key is configured, cannot decrypt.',
53 -
5453 );
Index: trunk/extensions/SecurePoll/voterList.php
@@ -12,22 +12,22 @@
1313 $listFile = fopen( "voter-list", "a" );
1414
1515 for ( $user = 1; $user <= $maxUser; $user++ ) {
16 - $oldEdits = $dbr->selectField(
17 - 'revision',
 16+ $oldEdits = $dbr->selectField(
 17+ 'revision',
1818 'COUNT(*)',
19 - array(
 19+ array(
2020 'rev_user' => $user,
2121 "rev_timestamp < '200803010000'"
22 - ),
 22+ ),
2323 $fname
2424 );
25 - $newEdits = $dbr->selectField(
26 - 'revision',
 25+ $newEdits = $dbr->selectField(
 26+ 'revision',
2727 'COUNT(*)',
28 - array(
 28+ array(
2929 'rev_user' => $user,
3030 "rev_timestamp BETWEEN '200801010000' AND '200805285959'"
31 - ),
 31+ ),
3232 $fname
3333 );
3434 if ( $oldEdits >= 600 && $newEdits >= 50 ) {
@@ -37,7 +37,7 @@
3838 $props[] = 'bot';
3939 }
4040 $isBlocked = $userObj->isBlocked();
41 - if ( $userObj->isBlocked()
 41+ if ( $userObj->isBlocked()
4242 && $userObj->mBlock->mExpiry == 'infinity' )
4343 {
4444 $props[] = 'indefblocked';
@@ -47,8 +47,8 @@
4848 $editCount = $userObj->getEditCount();
4949 $name = $userObj->getName();
5050
51 - fwrite( $listFile, "$wgDBname\t$server\t$name\t" .
 51+ fwrite( $listFile, "$wgDBname\t$server\t$name\t" .
5252 "$email\t$editCount\t$props\n" );
5353 }
5454 }
55 -fclose( $listFile );
\ No newline at end of file
 55+fclose( $listFile );
Index: trunk/extensions/SecurePoll/cacert-both.crt
@@ -74,4 +74,3 @@
7575 zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW
7676 omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD
7777 -----END CERTIFICATE-----
78 -
Index: trunk/extensions/SecurePoll/SecurePoll.php
@@ -10,7 +10,7 @@
1111 */
1212
1313 # Not a valid entry point, skip unless MEDIAWIKI is defined
14 -if( !defined('MEDIAWIKI') ) {
 14+if ( !defined( 'MEDIAWIKI' ) ) {
1515 die( "Not a valid entry point\n" );
1616 }
1717
@@ -41,7 +41,7 @@
4242 */
4343 $wgSecurePollShowErrorDetail = false;
4444
45 -#### END CONFIGURATON ###
 45+### END CONFIGURATON ###
4646
4747
4848
@@ -50,7 +50,7 @@
5151 $wgGroupPermissions['securepoll']['securepoll'] = true;
5252
5353 // Set up the new special page
54 -$dir = dirname(__FILE__);
 54+$dir = dirname( __FILE__ );
5555 $wgExtensionMessagesFiles['SecurePoll'] = "$dir/SecurePoll.i18n.php";
5656 $wgExtensionAliasesFiles['SecurePoll'] = "$dir/SecurePoll.alias.php";
5757
@@ -82,7 +82,7 @@
8383 function wfSetupSecurePoll() {
8484 wfSetupSession();
8585 if ( isset( $_SESSION['bvLang'] ) && !isset( $_REQUEST['uselang'] ) ) {
86 - wfDebug( __METHOD__.": Setting user language to {$_SESSION['bvLang']}\n" );
 86+ wfDebug( __METHOD__ . ": Setting user language to {$_SESSION['bvLang']}\n" );
8787 $_REQUEST['uselang'] = $_SESSION['bvLang'];
8888 global $wgLang;
8989 $wgLang = Language::factory( $_SESSION['bvLang'] );
Index: trunk/extensions/SecurePoll/includes/VotePage.php
@@ -15,7 +15,7 @@
1616 $wgOut->addWikiMsg( 'securepoll-too-few-params' );
1717 return;
1818 }
19 -
 19+
2020 $electionId = intval( $params[0] );
2121 $this->election = $this->parent->getElection( $electionId );
2222 if ( !$this->election ) {
@@ -32,7 +32,7 @@
3333 $languages = array( $this->user->getLanguage(), $this->election->getLanguage() );
3434 $languages = array_unique( $languages );
3535 SecurePoll_Entity::setLanguages( $languages );
36 -
 36+
3737 $wgOut->setPageTitle( $this->election->getMessage( 'title' ) );
3838
3939 if ( !$this->election->isStarted() ) {
@@ -86,7 +86,7 @@
8787 $encOK = wfMsgHtml( 'securepoll-submit' );
8888 $encToken = htmlspecialchars( $this->parent->getEditToken() );
8989
90 - $wgOut->addHTML(
 90+ $wgOut->addHTML(
9191 "<form name=\"securepoll\" id=\"securepoll\" method=\"post\" action=\"$encAction\">\n" .
9292 $this->election->getBallot()->getForm() .
9393 "<input name=\"submit\" type=\"submit\" value=\"$encOK\">\n" .
@@ -128,13 +128,13 @@
129129 $dbw->begin();
130130
131131 # Mark previous votes as old
132 - $dbw->update( 'securepoll_votes',
 132+ $dbw->update( 'securepoll_votes',
133133 array( 'vote_current' => 0 ), # SET
134134 array( # WHERE
135135 'vote_election' => $this->election->getId(),
136136 'vote_user' => $this->user->getId(),
137 - ),
138 - __METHOD__
 137+ ),
 138+ __METHOD__
139139 );
140140
141141 # Add vote to log
@@ -145,7 +145,7 @@
146146
147147 $tokenMatch = $this->parent->getEditToken() == $wgRequest->getVal( 'edit_token' );
148148
149 - $dbw->insert( 'securepoll_votes',
 149+ $dbw->insert( 'securepoll_votes',
150150 array(
151151 'vote_election' => $this->election->getId(),
152152 'vote_user' => $this->user->getId(),
@@ -156,7 +156,7 @@
157157 'vote_timestamp' => $now,
158158 'vote_current' => 1,
159159 'vote_token_match' => $tokenMatch ? 1 : 0,
160 - ),
 160+ ),
161161 __METHOD__ );
162162 $dbw->commit();
163163
Index: trunk/extensions/SecurePoll/includes/Entity.php
@@ -55,10 +55,10 @@
5656 }
5757
5858 $db = wfGetDB( DB_MASTER );
59 - $res = $db->select(
 59+ $res = $db->select(
6060 'securepoll_msgs',
6161 '*',
62 - array(
 62+ array(
6363 'msg_entity' => $ids,
6464 'msg_lang' => $lang
6565 ),
Index: trunk/extensions/SecurePoll/includes/Page.php
@@ -2,4 +2,3 @@
33
44 class SecurePoll_Page {
55 }
6 -
Index: trunk/extensions/SecurePoll/includes/Ballot.php
@@ -55,7 +55,7 @@
5656 $radioId = "{$name}_opt{$optionId}";
5757 $s .= Xml::radio( $name, $optionId, false, array( 'id' => $radioId ) ) .
5858 '&nbsp;' .
59 - Xml::tags( 'label', array( 'for' => $radioId ), $optionText ) .
 59+ Xml::tags( 'label', array( 'for' => $radioId ), $optionText ) .
6060 "<br/>\n";
6161 }
6262 }
@@ -129,6 +129,6 @@
130130 </td></tr>";
131131 }
132132
133 - function getForm() {}
134 - function submitForm() {}
 133+ function getForm() { }
 134+ function submitForm() { }
135135 }
Index: trunk/extensions/SecurePoll/includes/User.php
@@ -59,7 +59,7 @@
6060 function getLanguage() {
6161 return $this->getProperty( 'language', 'en' );
6262 }
63 -
 63+
6464 function getProperty( $name, $default = false ) {
6565 if ( isset( $this->properties[$name] ) ) {
6666 return $this->properties[$name];
Index: trunk/extensions/SecurePoll/includes/Auth.php
@@ -15,7 +15,7 @@
1616 }
1717
1818 function login( $election ) {
19 - if( session_id() == '' ) {
 19+ if ( session_id() == '' ) {
2020 wfSetupSession();
2121 }
2222 if ( isset( $_SESSION['bvUser'] ) ) {
@@ -27,12 +27,12 @@
2828
2929 function getUser( $params ) {
3030 $db = wfGetDB( DB_MASTER );
31 - $row = $db->selectRow(
32 - 'securepoll_voters', '*',
33 - array(
34 - 'voter_name' => $params['name'],
 31+ $row = $db->selectRow(
 32+ 'securepoll_voters', '*',
 33+ array(
 34+ 'voter_name' => $params['name'],
3535 'voter_domain' => $params['domain'],
36 - 'voter_authority' => $params['authority']
 36+ 'voter_authority' => $params['authority']
3737 ),
3838 __METHOD__ );
3939 if ( $row ) {
@@ -82,7 +82,7 @@
8383 foreach ( $urlParamNames as $name ) {
8484 $value = $wgRequest->getVal( $name );
8585 if ( !preg_match( '/^[\w.-]*$/', $value ) ) {
86 - wfDebug( __METHOD__." Invalid parameter: $name\n" );
 86+ wfDebug( __METHOD__ . " Invalid parameter: $name\n" );
8787 return false;
8888 }
8989 $vars["\$$name"] = $value;
@@ -102,7 +102,7 @@
103103 return false;
104104 }
105105 if ( !$params['remote-mw-cookie'] ) {
106 - wfDebug( __METHOD__.": No remote cookie configured!\n" );
 106+ wfDebug( __METHOD__ . ": No remote cookie configured!\n" );
107107 return false;
108108 }
109109 $cookies = array( $params['remote-mw-cookie'] => $params['sid'] );
@@ -110,11 +110,11 @@
111111 $cookies[$params['remote-mw-ca-cookie']] = $params['casid'];
112112 }
113113 $cookieHeader = $this->encodeCookies( $cookies );
114 - $url = $params['remote-mw-api-url'] .
 114+ $url = $params['remote-mw-api-url'] .
115115 '?action=query&format=php' .
116 - '&meta=userinfo&uiprop=blockinfo|rights|editcount|options' .
 116+ '&meta=userinfo&uiprop=blockinfo|rights|editcount|options' .
117117 '&meta=siteinfo';
118 - $curlParams = array(
 118+ $curlParams = array(
119119 CURLOPT_COOKIE => $cookieHeader,
120120
121121 // Use the default SSL certificate file
@@ -126,7 +126,7 @@
127127 $value = Http::get( $url, 20, $curlParams );
128128
129129 if ( !$value ) {
130 - wfDebug( __METHOD__.": No response from server\n" );
 130+ wfDebug( __METHOD__ . ": No response from server\n" );
131131 $_SESSION['bvCurlError'] = curl_error( $c );
132132 return false;
133133 }
@@ -135,11 +135,11 @@
136136 $userinfo = $decoded['query']['userinfo'];
137137 $siteinfo = $decoded['query']['general'];
138138 if ( isset( $userinfo['anon'] ) ) {
139 - wfDebug( __METHOD__.": User is not logged in\n" );
 139+ wfDebug( __METHOD__ . ": User is not logged in\n" );
140140 return false;
141141 }
142142 if ( !isset( $userinfo['name'] ) ) {
143 - wfDebug( __METHOD__.": No username in response\n" );
 143+ wfDebug( __METHOD__ . ": No username in response\n" );
144144 return false;
145145 }
146146 if ( isset( $userinfo['options']['language'] ) ) {
@@ -149,12 +149,12 @@
150150 }
151151 $urlInfo = wfParseUrl( $decoded['query']['general']['base'] );
152152 $domain = $urlInfo === false ? false : $urlInfo['host'];
153 - $userPage = $siteinfo['server'] .
154 - str_replace( $siteinfo['articlepath'], '$1', '' ) .
 153+ $userPage = $siteinfo['server'] .
 154+ str_replace( $siteinfo['articlepath'], '$1', '' ) .
155155 'User:' .
156156 urlencode( str_replace( $userinfo['name'], ' ', '_' ) );
157157
158 - wfDebug( __METHOD__." got response for user {$userinfo['name']}@{$params['wiki']}\n" );
 158+ wfDebug( __METHOD__ . " got response for user {$userinfo['name']}@{$params['wiki']}\n" );
159159 return $this->getUser( array(
160160 'name' => $userinfo['name'],
161161 'type' => 'remote-mw',
Index: trunk/extensions/SecurePoll/includes/Crypt.php
@@ -97,13 +97,13 @@
9898 closedir( $dir );
9999 rmdir( $this->homeDir );
100100 }
101 -
 101+
102102 function runGpg( $params ) {
103103 global $wgSecurePollGPGCommand, $wgSecurePollShowErrorDetail;
104104 $ret = 1;
105 - $command = wfEscapeShellArg( $wgSecurePollGPGCommand ) .
 105+ $command = wfEscapeShellArg( $wgSecurePollGPGCommand ) .
106106 ' --homedir ' . wfEscapeShellArg( $this->homeDir ) . ' --trust-model always --batch --yes ' .
107 - $params .
 107+ $params .
108108 ' 2>&1';
109109 $output = wfShellExec( $command, $ret );
110110 if ( $ret ) {
Index: trunk/extensions/SecurePoll/includes/Election.php
@@ -49,15 +49,15 @@
5050 }
5151
5252 function getQualifiedStatus( $user ) {
53 - return Status::newGood();
 53+ return Status::newGood();
5454 }
5555
5656 function hasVoted( $user ) {
5757 $db = wfGetDB( DB_MASTER );
58 - $row = $db->selectRow(
59 - 'securepoll_votes',
 58+ $row = $db->selectRow(
 59+ 'securepoll_votes',
6060 array( "1" ),
61 - array(
 61+ array(
6262 'vote_election' => $this->getId(),
6363 'vote_user' => $user->getId(),
6464 ),
@@ -72,13 +72,13 @@
7373 function getQuestions() {
7474 if ( $this->questions === null ) {
7575 $db = wfGetDB( DB_MASTER );
76 - $res = $db->select(
 76+ $res = $db->select(
7777 array( 'securepoll_questions', 'securepoll_options' ),
78 - '*',
79 - array(
 78+ '*',
 79+ array(
8080 'qu_election' => $this->getId(),
8181 'op_question=qu_entity'
82 - ),
 82+ ),
8383 __METHOD__,
8484 array( 'ORDER BY' => 'qu_index, qu_entity' )
8585 );
Index: trunk/extensions/SecurePoll/includes/Question.php
@@ -11,5 +11,4 @@
1212 function getChildren() {
1313 return $this->options;
1414 }
15 -
1615 }
Index: trunk/extensions/SecurePoll/includes/Option.php
@@ -9,4 +9,3 @@
1010 parent::__construct( 'option', $id );
1111 }
1212 }
13 -
Index: trunk/extensions/SecurePoll/tally.php
@@ -1,10 +1,10 @@
22 <?php
33
4 -if( php_sapi_name() != 'cli' ) {
5 - die("");
 4+if ( php_sapi_name() != 'cli' ) {
 5+ die( "" );
66 }
77
8 -if( !isset( $argv[1] ) ) {
 8+if ( !isset( $argv[1] ) ) {
99 die( "You must provide a vote log file on the command line.\n" );
1010 }
1111
@@ -19,7 +19,7 @@
2020
2121 $end = "-----END PGP MESSAGE-----";
2222 $contents = file_get_contents( $argv[1] );
23 -if( $contents === false ) {
 23+if ( $contents === false ) {
2424 die( "Couldn't open input file.\n" );
2525 }
2626 $entries = explode( $end, $contents );
@@ -27,7 +27,7 @@
2828 $infile = tempnam( "/tmp", "gpg" );
2929 $outfile = tempnam( "/tmp", "gpg" );
3030
31 -if( !isset( $argv[2] ) ) {
 31+if ( !isset( $argv[2] ) ) {
3232 $votesfile = "results.txt";
3333 } else {
3434 $votesfile = $argv[2];
@@ -40,7 +40,7 @@
4141 fwrite( $vfs, "\n== Votes ==\n" );
4242
4343 foreach ( $entries as $i => $entry ) {
44 - $entry = trim( $entry.$end );
 44+ $entry = trim( $entry . $end );
4545
4646 if ( $entry == $end ) {
4747 continue;
@@ -53,15 +53,15 @@
5454 $lines = file( $outfile );
5555 $ballot = process_line( $lines[0] );
5656 $ballots[ $i ] = $ballot;
57 -
 57+
5858 asort( $ballot );
5959 $vote = "# ";
6060 $aliasBallot =& $ballot;
61 - foreach( $aliasBallot as $cname => $crank ) {
 61+ foreach ( $aliasBallot as $cname => $crank ) {
6262 $vote .= $boardCandidates[ $cname ];
63 -
 63+
6464 $ncrank = current( $aliasBallot ); // current() return the next element for an array alias inside a foreach()
65 - if( $ncrank ) {
 65+ if ( $ncrank ) {
6666 $vote .= ( $crank < $ncrank ) ? "," : "";
6767 }
6868 }
@@ -82,7 +82,7 @@
8383
8484 $orderedCandidates = sort_candidate_by_wins( $boardCandidates, $beatpathWVMatrix, $beatpathMMatrix );
8585
86 -### Output results ###
 86+# ## Output results ###
8787 fwrite( $vfs, "== Pairwise defeats matrix ==\n" );
8888 output_table( $vfs, $defeatMatrix );
8989 fwrite( $vfs, "\nFor the above table, a row beats a column by N votes.\n\n" .
@@ -102,7 +102,7 @@
103103
104104 fclose( $vfs );
105105
106 -#-----------------------------------------------------------
 106+# -----------------------------------------------------------
107107
108108 function process_line( $line ) {
109109 $importantBit = substr( $line, strpos( $line, ":" ) + 1 );
@@ -111,8 +111,8 @@
112112 foreach ( $set as $i ) {
113113 $rank = substr( $i, strpos( $i, "[" ) + 1 );
114114 $rank = substr( $rank, 0, -1 );
115 -
116 - $ballot[ substr( $i, 0, -( strlen( $rank ) + 2 ) ) ] = (int)$rank;
 115+
 116+ $ballot[ substr( $i, 0, - ( strlen( $rank ) + 2 ) ) ] = (int)$rank;
117117 // ^^^
118118 // '[',']'
119119 }
@@ -127,7 +127,7 @@
128128 $defeats[ $c ][ $opp ] = 0;
129129 }
130130 }
131 -
 131+
132132 foreach ( $ballots as $ballot ) {
133133 foreach ( $ballot as $candidate => $rank ) {
134134 foreach ( $ballot as $opponent => $oppRank ) {
@@ -139,7 +139,7 @@
140140 }
141141 }
142142 }
143 -
 143+
144144 return $defeats;
145145 }
146146
@@ -150,7 +150,7 @@
151151 $matrix[ $c ][ $opp ] = 0;
152152 }
153153 }
154 -
 154+
155155 foreach ( $defeats as $candidate => $opponents ) {
156156 foreach ( $opponents as $opponent => $votes ) {
157157 if ( $candidate != $opponent ) {
@@ -161,7 +161,7 @@
162162 }
163163 }
164164 }
165 -
 165+
166166 return $matrix;
167167 }
168168
@@ -183,7 +183,7 @@
184184 }
185185 }
186186 }
187 -
 187+
188188 return $matrix;
189189 }
190190
@@ -200,7 +200,7 @@
201201 }
202202 }
203203 }
204 -
 204+
205205 return $paths;
206206 }
207207
@@ -212,7 +212,7 @@
213213 foreach ( $opps as $k => $dummy2 ) {
214214 if ( ( $c != $k ) && ( $opp != $k ) ) {
215215 if ( ( $wvp[ $c ][ $k ] < $wvp[ $opp ][ $c ] ) ||
216 - ( ( $wvp[ $c ][ $k ] == $wvp[ $opp ][ $c ] ) &&
 216+ ( ( $wvp[ $c ][ $k ] == $wvp[ $opp ][ $c ] ) &&
217217 ( $mp[ $c ][ $k ] < $mp[ $opp ][ $c ] ) ) ) {
218218 $wvipath = $wvp[ $c ][ $k ];
219219 $mipath = $mp[ $c ][ $k ];
@@ -220,9 +220,9 @@
221221 $wvipath = $wvp[ $opp ][ $c ];
222222 $mipath = $mp[ $opp ][ $c ];
223223 }
224 -
 224+
225225 if ( ( $wvp[ $opp ][ $k ] < $wvipath ) ||
226 - ( ( $wvp[ $opp ][ $k ] == $wvipath ) &&
 226+ ( ( $wvp[ $opp ][ $k ] == $wvipath ) &&
227227 ( $mp[ $opp ][ $k ] < $mipath ) ) ) {
228228 $wvp[ $opp ][ $k ] = $wvipath;
229229 $mp[ $opp ][ $k ] = $mipath;
@@ -240,26 +240,26 @@
241241 }
242242
243243 $winners = $candidates;
244 -
 244+
245245 foreach ( $candidates as $c => $dummy1 ) {
246246 foreach ( $candidates as $opp => $dummy2 ) {
247247 if ( $c != $opp ) {
248248 if ( ( $wvpaths[ $c ][ $opp ] > $wvpaths[ $opp ][ $c ] ) ||
249 - ( ( $wvpaths[ $c ][ $opp ] == $wvpaths[ $opp ][ $c ] ) &&
 249+ ( ( $wvpaths[ $c ][ $opp ] == $wvpaths[ $opp ][ $c ] ) &&
250250 ( $mpaths[ $c ][ $opp ] > $mpaths[ $opp ][ $c ] ) ) ) {
251251 unset( $winners[ $opp ] );
252252 }
253253 }
254254 }
255255 }
256 -
 256+
257257 if ( count( $winners ) > 1 ) {
258258 $ties = "";
259259 foreach ( $winners as $wname => $wl ) {
260260 $ties .= ( $wname . ", " );
261261 }
262262 $ties = substr( $ties, 0, -2 );
263 -
 263+
264264 print "Ties between : " . $ties . "\n";
265265 }
266266
@@ -272,7 +272,7 @@
273273
274274 function output_table( &$fs, &$matrix ) {
275275 global $boardCandidates;
276 -
 276+
277277 $line = "{| class=\"wikitable\" style=\"text-align:center\"\n|-\n! \n";
278278 foreach ( $boardCandidates as $name => $idx ) {
279279 $line .= ( "! " . $idx . "\n" );

Status & tagging log