Index: trunk/extensions/AjaxLogin/AjaxLogin.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
12 | 12 | */ |
13 | 13 | |
14 | | -if( !defined( 'MEDIAWIKI' ) ){ |
| 14 | +if ( !defined( 'MEDIAWIKI' ) ) { |
15 | 15 | die( "This is not a valid entry point.\n" ); |
16 | 16 | } |
17 | 17 | |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Adds required JavaScript & CSS files to the HTML output of a page if AjaxLogin is enabled |
49 | | - * |
| 49 | + * |
50 | 50 | * @param $out OutputPage object |
51 | 51 | * @return true |
52 | 52 | */ |
— | — | @@ -53,15 +53,15 @@ |
54 | 54 | global $wgEnableAjaxLogin, $wgScriptPath, $wgJsMimeType; |
55 | 55 | |
56 | 56 | # Don't load anything if AjaxLogin isn't enabled |
57 | | - if( !isset( $wgEnableAjaxLogin ) ) { |
| 57 | + if ( !isset( $wgEnableAjaxLogin ) ) { |
58 | 58 | return true; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // YUI library dependencies |
62 | 62 | // 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" ); |
64 | 64 | // 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" ); |
66 | 66 | // YUI styles -- these introduce some CSS warnings when included... |
67 | 67 | $out->addExtensionStyle( 'http://yui.yahooapis.com/2.7.0/build/container/assets/container.css' ); |
68 | 68 | $out->addExtensionStyle( 'http://yui.yahooapis.com/2.7.0/build/container/assets/container-core.css' ); |
— | — | @@ -80,11 +80,11 @@ |
81 | 81 | * @param $vars Variables to be added |
82 | 82 | * @return true |
83 | 83 | */ |
84 | | -function efAddAjaxLoginVariables( $vars ){ |
| 84 | +function efAddAjaxLoginVariables( $vars ) { |
85 | 85 | global $wgEnableAjaxLogin; |
86 | 86 | |
87 | 87 | $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'] ) { |
89 | 89 | wfLoadExtensionMessages( 'AjaxLogin' ); |
90 | 90 | $vars['ajaxLogin1'] = wfMsg( 'ajaxLogin1' ); |
91 | 91 | $vars['ajaxLogin2'] = wfMsg( 'ajaxLogin2' ); |
— | — | @@ -101,37 +101,37 @@ |
102 | 102 | */ |
103 | 103 | function GetAjaxLoginForm( &$data ) { |
104 | 104 | 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' ) { |
106 | 106 | $titleObj = SpecialPage::getTitleFor( 'Userlogin' ); |
107 | 107 | $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]--> |
109 | 109 | <div id="userloginRound" class="roundedDiv yui-module yui-overlay yui-panel" style="display:none; background:none; border:none;"> |
110 | 110 | <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b> |
111 | 111 | <div class="r_boxContent"> |
112 | | - <div class="boxHeader color1">'. wfMsg( 'login' ) .'</div> |
| 112 | + <div class="boxHeader color1">' . wfMsg( 'login' ) . '</div> |
113 | 113 | <form action="" method="post" name="userajaxloginform" id="userajaxloginform" style="margin:5px"> |
114 | 114 | <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 /> |
116 | 116 | <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 /> |
118 | 118 | <input type="password" class="loginPassword" name="wpPassword" id="wpPassword1" tabindex="102" size="20" /><br /> |
119 | 119 | <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 /> |
122 | 122 | </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' ) . '" />' |
124 | 124 | ); |
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' ) . '" />' ); |
127 | 127 | } |
128 | 128 | // Originally this used core message 'nologinlink' but it wouldn't work too well for Finnish, so I changed it. --Jack Phoenix |
129 | 129 | 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> |
131 | 131 | </form> |
132 | 132 | |
133 | 133 | </div> |
134 | 134 | <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b> |
135 | | -</div>'); |
| 135 | +</div>' ); |
136 | 136 | } |
137 | 137 | return true; |
138 | 138 | } |
\ No newline at end of file |
Index: trunk/extensions/AjaxLogin/ApiAjaxLogin.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @author Inez Korczyński <korczynski@gmail.com> |
9 | 9 | */ |
10 | 10 | |
11 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
12 | 12 | die( "This is not a valid entry point.\n" ); |
13 | 13 | } |
14 | 14 | |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | $Name = $Password = $Remember = $Loginattempt = $Mailmypassword = null; |
23 | 23 | extract( $this->extractRequestParams() ); |
24 | 24 | |
25 | | - if( !empty( $Loginattempt ) ) { |
| 25 | + if ( !empty( $Loginattempt ) ) { |
26 | 26 | // Login attempt |
27 | 27 | $params = new FauxRequest( |
28 | 28 | array( |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | $dbw->commit(); |
82 | 82 | |
83 | 83 | $this->getResult()->addValue( null, 'ajaxlogin', $result ); |
84 | | - } else if( !empty( $Mailmypassword ) ) { |
| 84 | + } else if ( !empty( $Mailmypassword ) ) { |
85 | 85 | // Remind password attempt |
86 | 86 | $params = new FauxRequest( |
87 | 87 | array( |
— | — | @@ -90,10 +90,10 @@ |
91 | 91 | $result = array(); |
92 | 92 | $loginForm = new LoginForm( $params ); |
93 | 93 | global $wgUser, $wgOut, $wgAuth; |
94 | | - if( !$wgAuth->allowPasswordChange() ) { |
| 94 | + if ( !$wgAuth->allowPasswordChange() ) { |
95 | 95 | $result['result'] = 'resetpass_forbidden'; |
96 | 96 | $result['text'] = wfMsg( 'resetpass_forbidden' ); |
97 | | - } else if( $wgUser->isBlocked() ) { |
| 97 | + } else if ( $wgUser->isBlocked() ) { |
98 | 98 | $result['result'] = 'blocked-mailpassword'; |
99 | 99 | $result['text'] = wfMsg( 'blocked-mailpassword' ); |
100 | 100 | } else if ( '' == $loginForm->mName ) { |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | $result['text'] = wfMsg( 'noname' ); |
103 | 103 | } else { |
104 | 104 | $u = User::newFromName( $loginForm->mName ); |
105 | | - if( is_null( $u ) ) { |
| 105 | + if ( is_null( $u ) ) { |
106 | 106 | $result['result'] = 'noname'; |
107 | 107 | $result['text'] = wfMsg( 'noname' ); |
108 | 108 | } else if ( 0 == $u->getID() ) { |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | $result['text'] = wfMsg( 'throttled-mailpassword', round( $wgPasswordReminderResendTime, 3 ) ); |
115 | 115 | } else { |
116 | 116 | $res = $loginForm->mailPasswordInternal( $u, true ); |
117 | | - if( WikiError::isError( $res ) ) { |
| 117 | + if ( WikiError::isError( $res ) ) { |
118 | 118 | $result['result'] = 'mailerror'; |
119 | 119 | $result['text'] = wfMsg( 'mailerror', $res->getMessage() ); |
120 | 120 | } else { |
Index: trunk/extensions/SecurePoll/SecurePoll_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 | |
Index: trunk/extensions/SecurePoll/GoToBoardVote_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 | |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | } |
41 | 41 | |
42 | 42 | if ( $wgUser->isLoggedIn() ) { |
43 | | - #$url = 'http://shimmer/farm/frwiki/index.php?' . wfArrayToCGI( array( |
| 43 | + # $url = 'http://shimmer/farm/frwiki/index.php?' . wfArrayToCGI( array( |
44 | 44 | $url = 'https://wikimedia.spi-inc.org/index.php?' . wfArrayToCGI( array( |
45 | 45 | 'title' => 'Special:BoardVote' . ( $par ? "/$par" : '' ), |
46 | 46 | 'sid' => session_id(), |
Index: trunk/extensions/SecurePoll/SecurePoll.i18n.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | 'securepoll-no-gpg-home' => 'Unable to create GPG home directory.', |
42 | 42 | 'securepoll-secret-gpg-error' => 'Error executing GPG. |
43 | 43 | 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: |
45 | 45 | |
46 | 46 | Command: $1 |
47 | 47 | |
— | — | @@ -49,5 +49,4 @@ |
50 | 50 | 'securepoll-gpg-config-error' => 'GPG keys are configured incorrectly.', |
51 | 51 | 'securepoll-gpg-parse-error' => 'Error interpreting GPG output.', |
52 | 52 | 'securepoll-no-decryption-key' => 'No decryption key is configured, cannot decrypt.', |
53 | | - |
54 | 53 | ); |
Index: trunk/extensions/SecurePoll/voterList.php |
— | — | @@ -12,22 +12,22 @@ |
13 | 13 | $listFile = fopen( "voter-list", "a" ); |
14 | 14 | |
15 | 15 | for ( $user = 1; $user <= $maxUser; $user++ ) { |
16 | | - $oldEdits = $dbr->selectField( |
17 | | - 'revision', |
| 16 | + $oldEdits = $dbr->selectField( |
| 17 | + 'revision', |
18 | 18 | 'COUNT(*)', |
19 | | - array( |
| 19 | + array( |
20 | 20 | 'rev_user' => $user, |
21 | 21 | "rev_timestamp < '200803010000'" |
22 | | - ), |
| 22 | + ), |
23 | 23 | $fname |
24 | 24 | ); |
25 | | - $newEdits = $dbr->selectField( |
26 | | - 'revision', |
| 25 | + $newEdits = $dbr->selectField( |
| 26 | + 'revision', |
27 | 27 | 'COUNT(*)', |
28 | | - array( |
| 28 | + array( |
29 | 29 | 'rev_user' => $user, |
30 | 30 | "rev_timestamp BETWEEN '200801010000' AND '200805285959'" |
31 | | - ), |
| 31 | + ), |
32 | 32 | $fname |
33 | 33 | ); |
34 | 34 | if ( $oldEdits >= 600 && $newEdits >= 50 ) { |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | $props[] = 'bot'; |
39 | 39 | } |
40 | 40 | $isBlocked = $userObj->isBlocked(); |
41 | | - if ( $userObj->isBlocked() |
| 41 | + if ( $userObj->isBlocked() |
42 | 42 | && $userObj->mBlock->mExpiry == 'infinity' ) |
43 | 43 | { |
44 | 44 | $props[] = 'indefblocked'; |
— | — | @@ -47,8 +47,8 @@ |
48 | 48 | $editCount = $userObj->getEditCount(); |
49 | 49 | $name = $userObj->getName(); |
50 | 50 | |
51 | | - fwrite( $listFile, "$wgDBname\t$server\t$name\t" . |
| 51 | + fwrite( $listFile, "$wgDBname\t$server\t$name\t" . |
52 | 52 | "$email\t$editCount\t$props\n" ); |
53 | 53 | } |
54 | 54 | } |
55 | | -fclose( $listFile ); |
\ No newline at end of file |
| 55 | +fclose( $listFile ); |
Index: trunk/extensions/SecurePoll/cacert-both.crt |
— | — | @@ -74,4 +74,3 @@ |
75 | 75 | zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW |
76 | 76 | omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD |
77 | 77 | -----END CERTIFICATE----- |
78 | | - |
Index: trunk/extensions/SecurePoll/SecurePoll.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | */ |
12 | 12 | |
13 | 13 | # Not a valid entry point, skip unless MEDIAWIKI is defined |
14 | | -if( !defined('MEDIAWIKI') ) { |
| 14 | +if ( !defined( 'MEDIAWIKI' ) ) { |
15 | 15 | die( "Not a valid entry point\n" ); |
16 | 16 | } |
17 | 17 | |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | */ |
43 | 43 | $wgSecurePollShowErrorDetail = false; |
44 | 44 | |
45 | | -#### END CONFIGURATON ### |
| 45 | +### END CONFIGURATON ### |
46 | 46 | |
47 | 47 | |
48 | 48 | |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | $wgGroupPermissions['securepoll']['securepoll'] = true; |
52 | 52 | |
53 | 53 | // Set up the new special page |
54 | | -$dir = dirname(__FILE__); |
| 54 | +$dir = dirname( __FILE__ ); |
55 | 55 | $wgExtensionMessagesFiles['SecurePoll'] = "$dir/SecurePoll.i18n.php"; |
56 | 56 | $wgExtensionAliasesFiles['SecurePoll'] = "$dir/SecurePoll.alias.php"; |
57 | 57 | |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | function wfSetupSecurePoll() { |
84 | 84 | wfSetupSession(); |
85 | 85 | 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" ); |
87 | 87 | $_REQUEST['uselang'] = $_SESSION['bvLang']; |
88 | 88 | global $wgLang; |
89 | 89 | $wgLang = Language::factory( $_SESSION['bvLang'] ); |
Index: trunk/extensions/SecurePoll/includes/VotePage.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | $wgOut->addWikiMsg( 'securepoll-too-few-params' ); |
17 | 17 | return; |
18 | 18 | } |
19 | | - |
| 19 | + |
20 | 20 | $electionId = intval( $params[0] ); |
21 | 21 | $this->election = $this->parent->getElection( $electionId ); |
22 | 22 | if ( !$this->election ) { |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | $languages = array( $this->user->getLanguage(), $this->election->getLanguage() ); |
34 | 34 | $languages = array_unique( $languages ); |
35 | 35 | SecurePoll_Entity::setLanguages( $languages ); |
36 | | - |
| 36 | + |
37 | 37 | $wgOut->setPageTitle( $this->election->getMessage( 'title' ) ); |
38 | 38 | |
39 | 39 | if ( !$this->election->isStarted() ) { |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | $encOK = wfMsgHtml( 'securepoll-submit' ); |
88 | 88 | $encToken = htmlspecialchars( $this->parent->getEditToken() ); |
89 | 89 | |
90 | | - $wgOut->addHTML( |
| 90 | + $wgOut->addHTML( |
91 | 91 | "<form name=\"securepoll\" id=\"securepoll\" method=\"post\" action=\"$encAction\">\n" . |
92 | 92 | $this->election->getBallot()->getForm() . |
93 | 93 | "<input name=\"submit\" type=\"submit\" value=\"$encOK\">\n" . |
— | — | @@ -128,13 +128,13 @@ |
129 | 129 | $dbw->begin(); |
130 | 130 | |
131 | 131 | # Mark previous votes as old |
132 | | - $dbw->update( 'securepoll_votes', |
| 132 | + $dbw->update( 'securepoll_votes', |
133 | 133 | array( 'vote_current' => 0 ), # SET |
134 | 134 | array( # WHERE |
135 | 135 | 'vote_election' => $this->election->getId(), |
136 | 136 | 'vote_user' => $this->user->getId(), |
137 | | - ), |
138 | | - __METHOD__ |
| 137 | + ), |
| 138 | + __METHOD__ |
139 | 139 | ); |
140 | 140 | |
141 | 141 | # Add vote to log |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | |
147 | 147 | $tokenMatch = $this->parent->getEditToken() == $wgRequest->getVal( 'edit_token' ); |
148 | 148 | |
149 | | - $dbw->insert( 'securepoll_votes', |
| 149 | + $dbw->insert( 'securepoll_votes', |
150 | 150 | array( |
151 | 151 | 'vote_election' => $this->election->getId(), |
152 | 152 | 'vote_user' => $this->user->getId(), |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | 'vote_timestamp' => $now, |
158 | 158 | 'vote_current' => 1, |
159 | 159 | 'vote_token_match' => $tokenMatch ? 1 : 0, |
160 | | - ), |
| 160 | + ), |
161 | 161 | __METHOD__ ); |
162 | 162 | $dbw->commit(); |
163 | 163 | |
Index: trunk/extensions/SecurePoll/includes/Entity.php |
— | — | @@ -55,10 +55,10 @@ |
56 | 56 | } |
57 | 57 | |
58 | 58 | $db = wfGetDB( DB_MASTER ); |
59 | | - $res = $db->select( |
| 59 | + $res = $db->select( |
60 | 60 | 'securepoll_msgs', |
61 | 61 | '*', |
62 | | - array( |
| 62 | + array( |
63 | 63 | 'msg_entity' => $ids, |
64 | 64 | 'msg_lang' => $lang |
65 | 65 | ), |
Index: trunk/extensions/SecurePoll/includes/Page.php |
— | — | @@ -2,4 +2,3 @@ |
3 | 3 | |
4 | 4 | class SecurePoll_Page { |
5 | 5 | } |
6 | | - |
Index: trunk/extensions/SecurePoll/includes/Ballot.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | $radioId = "{$name}_opt{$optionId}"; |
57 | 57 | $s .= Xml::radio( $name, $optionId, false, array( 'id' => $radioId ) ) . |
58 | 58 | ' ' . |
59 | | - Xml::tags( 'label', array( 'for' => $radioId ), $optionText ) . |
| 59 | + Xml::tags( 'label', array( 'for' => $radioId ), $optionText ) . |
60 | 60 | "<br/>\n"; |
61 | 61 | } |
62 | 62 | } |
— | — | @@ -129,6 +129,6 @@ |
130 | 130 | </td></tr>"; |
131 | 131 | } |
132 | 132 | |
133 | | - function getForm() {} |
134 | | - function submitForm() {} |
| 133 | + function getForm() { } |
| 134 | + function submitForm() { } |
135 | 135 | } |
Index: trunk/extensions/SecurePoll/includes/User.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | function getLanguage() { |
61 | 61 | return $this->getProperty( 'language', 'en' ); |
62 | 62 | } |
63 | | - |
| 63 | + |
64 | 64 | function getProperty( $name, $default = false ) { |
65 | 65 | if ( isset( $this->properties[$name] ) ) { |
66 | 66 | return $this->properties[$name]; |
Index: trunk/extensions/SecurePoll/includes/Auth.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | } |
17 | 17 | |
18 | 18 | function login( $election ) { |
19 | | - if( session_id() == '' ) { |
| 19 | + if ( session_id() == '' ) { |
20 | 20 | wfSetupSession(); |
21 | 21 | } |
22 | 22 | if ( isset( $_SESSION['bvUser'] ) ) { |
— | — | @@ -27,12 +27,12 @@ |
28 | 28 | |
29 | 29 | function getUser( $params ) { |
30 | 30 | $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'], |
35 | 35 | 'voter_domain' => $params['domain'], |
36 | | - 'voter_authority' => $params['authority'] |
| 36 | + 'voter_authority' => $params['authority'] |
37 | 37 | ), |
38 | 38 | __METHOD__ ); |
39 | 39 | if ( $row ) { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | foreach ( $urlParamNames as $name ) { |
84 | 84 | $value = $wgRequest->getVal( $name ); |
85 | 85 | if ( !preg_match( '/^[\w.-]*$/', $value ) ) { |
86 | | - wfDebug( __METHOD__." Invalid parameter: $name\n" ); |
| 86 | + wfDebug( __METHOD__ . " Invalid parameter: $name\n" ); |
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | $vars["\$$name"] = $value; |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | if ( !$params['remote-mw-cookie'] ) { |
106 | | - wfDebug( __METHOD__.": No remote cookie configured!\n" ); |
| 106 | + wfDebug( __METHOD__ . ": No remote cookie configured!\n" ); |
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | $cookies = array( $params['remote-mw-cookie'] => $params['sid'] ); |
— | — | @@ -110,11 +110,11 @@ |
111 | 111 | $cookies[$params['remote-mw-ca-cookie']] = $params['casid']; |
112 | 112 | } |
113 | 113 | $cookieHeader = $this->encodeCookies( $cookies ); |
114 | | - $url = $params['remote-mw-api-url'] . |
| 114 | + $url = $params['remote-mw-api-url'] . |
115 | 115 | '?action=query&format=php' . |
116 | | - '&meta=userinfo&uiprop=blockinfo|rights|editcount|options' . |
| 116 | + '&meta=userinfo&uiprop=blockinfo|rights|editcount|options' . |
117 | 117 | '&meta=siteinfo'; |
118 | | - $curlParams = array( |
| 118 | + $curlParams = array( |
119 | 119 | CURLOPT_COOKIE => $cookieHeader, |
120 | 120 | |
121 | 121 | // Use the default SSL certificate file |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | $value = Http::get( $url, 20, $curlParams ); |
128 | 128 | |
129 | 129 | if ( !$value ) { |
130 | | - wfDebug( __METHOD__.": No response from server\n" ); |
| 130 | + wfDebug( __METHOD__ . ": No response from server\n" ); |
131 | 131 | $_SESSION['bvCurlError'] = curl_error( $c ); |
132 | 132 | return false; |
133 | 133 | } |
— | — | @@ -135,11 +135,11 @@ |
136 | 136 | $userinfo = $decoded['query']['userinfo']; |
137 | 137 | $siteinfo = $decoded['query']['general']; |
138 | 138 | if ( isset( $userinfo['anon'] ) ) { |
139 | | - wfDebug( __METHOD__.": User is not logged in\n" ); |
| 139 | + wfDebug( __METHOD__ . ": User is not logged in\n" ); |
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | if ( !isset( $userinfo['name'] ) ) { |
143 | | - wfDebug( __METHOD__.": No username in response\n" ); |
| 143 | + wfDebug( __METHOD__ . ": No username in response\n" ); |
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | if ( isset( $userinfo['options']['language'] ) ) { |
— | — | @@ -149,12 +149,12 @@ |
150 | 150 | } |
151 | 151 | $urlInfo = wfParseUrl( $decoded['query']['general']['base'] ); |
152 | 152 | $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', '' ) . |
155 | 155 | 'User:' . |
156 | 156 | urlencode( str_replace( $userinfo['name'], ' ', '_' ) ); |
157 | 157 | |
158 | | - wfDebug( __METHOD__." got response for user {$userinfo['name']}@{$params['wiki']}\n" ); |
| 158 | + wfDebug( __METHOD__ . " got response for user {$userinfo['name']}@{$params['wiki']}\n" ); |
159 | 159 | return $this->getUser( array( |
160 | 160 | 'name' => $userinfo['name'], |
161 | 161 | 'type' => 'remote-mw', |
Index: trunk/extensions/SecurePoll/includes/Crypt.php |
— | — | @@ -97,13 +97,13 @@ |
98 | 98 | closedir( $dir ); |
99 | 99 | rmdir( $this->homeDir ); |
100 | 100 | } |
101 | | - |
| 101 | + |
102 | 102 | function runGpg( $params ) { |
103 | 103 | global $wgSecurePollGPGCommand, $wgSecurePollShowErrorDetail; |
104 | 104 | $ret = 1; |
105 | | - $command = wfEscapeShellArg( $wgSecurePollGPGCommand ) . |
| 105 | + $command = wfEscapeShellArg( $wgSecurePollGPGCommand ) . |
106 | 106 | ' --homedir ' . wfEscapeShellArg( $this->homeDir ) . ' --trust-model always --batch --yes ' . |
107 | | - $params . |
| 107 | + $params . |
108 | 108 | ' 2>&1'; |
109 | 109 | $output = wfShellExec( $command, $ret ); |
110 | 110 | if ( $ret ) { |
Index: trunk/extensions/SecurePoll/includes/Election.php |
— | — | @@ -49,15 +49,15 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | function getQualifiedStatus( $user ) { |
53 | | - return Status::newGood(); |
| 53 | + return Status::newGood(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | function hasVoted( $user ) { |
57 | 57 | $db = wfGetDB( DB_MASTER ); |
58 | | - $row = $db->selectRow( |
59 | | - 'securepoll_votes', |
| 58 | + $row = $db->selectRow( |
| 59 | + 'securepoll_votes', |
60 | 60 | array( "1" ), |
61 | | - array( |
| 61 | + array( |
62 | 62 | 'vote_election' => $this->getId(), |
63 | 63 | 'vote_user' => $user->getId(), |
64 | 64 | ), |
— | — | @@ -72,13 +72,13 @@ |
73 | 73 | function getQuestions() { |
74 | 74 | if ( $this->questions === null ) { |
75 | 75 | $db = wfGetDB( DB_MASTER ); |
76 | | - $res = $db->select( |
| 76 | + $res = $db->select( |
77 | 77 | array( 'securepoll_questions', 'securepoll_options' ), |
78 | | - '*', |
79 | | - array( |
| 78 | + '*', |
| 79 | + array( |
80 | 80 | 'qu_election' => $this->getId(), |
81 | 81 | 'op_question=qu_entity' |
82 | | - ), |
| 82 | + ), |
83 | 83 | __METHOD__, |
84 | 84 | array( 'ORDER BY' => 'qu_index, qu_entity' ) |
85 | 85 | ); |
Index: trunk/extensions/SecurePoll/includes/Question.php |
— | — | @@ -11,5 +11,4 @@ |
12 | 12 | function getChildren() { |
13 | 13 | return $this->options; |
14 | 14 | } |
15 | | - |
16 | 15 | } |
Index: trunk/extensions/SecurePoll/includes/Option.php |
— | — | @@ -9,4 +9,3 @@ |
10 | 10 | parent::__construct( 'option', $id ); |
11 | 11 | } |
12 | 12 | } |
13 | | - |
Index: trunk/extensions/SecurePoll/tally.php |
— | — | @@ -1,10 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if( php_sapi_name() != 'cli' ) { |
5 | | - die(""); |
| 4 | +if ( php_sapi_name() != 'cli' ) { |
| 5 | + die( "" ); |
6 | 6 | } |
7 | 7 | |
8 | | -if( !isset( $argv[1] ) ) { |
| 8 | +if ( !isset( $argv[1] ) ) { |
9 | 9 | die( "You must provide a vote log file on the command line.\n" ); |
10 | 10 | } |
11 | 11 | |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | |
21 | 21 | $end = "-----END PGP MESSAGE-----"; |
22 | 22 | $contents = file_get_contents( $argv[1] ); |
23 | | -if( $contents === false ) { |
| 23 | +if ( $contents === false ) { |
24 | 24 | die( "Couldn't open input file.\n" ); |
25 | 25 | } |
26 | 26 | $entries = explode( $end, $contents ); |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | $infile = tempnam( "/tmp", "gpg" ); |
29 | 29 | $outfile = tempnam( "/tmp", "gpg" ); |
30 | 30 | |
31 | | -if( !isset( $argv[2] ) ) { |
| 31 | +if ( !isset( $argv[2] ) ) { |
32 | 32 | $votesfile = "results.txt"; |
33 | 33 | } else { |
34 | 34 | $votesfile = $argv[2]; |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | fwrite( $vfs, "\n== Votes ==\n" ); |
42 | 42 | |
43 | 43 | foreach ( $entries as $i => $entry ) { |
44 | | - $entry = trim( $entry.$end ); |
| 44 | + $entry = trim( $entry . $end ); |
45 | 45 | |
46 | 46 | if ( $entry == $end ) { |
47 | 47 | continue; |
— | — | @@ -53,15 +53,15 @@ |
54 | 54 | $lines = file( $outfile ); |
55 | 55 | $ballot = process_line( $lines[0] ); |
56 | 56 | $ballots[ $i ] = $ballot; |
57 | | - |
| 57 | + |
58 | 58 | asort( $ballot ); |
59 | 59 | $vote = "# "; |
60 | 60 | $aliasBallot =& $ballot; |
61 | | - foreach( $aliasBallot as $cname => $crank ) { |
| 61 | + foreach ( $aliasBallot as $cname => $crank ) { |
62 | 62 | $vote .= $boardCandidates[ $cname ]; |
63 | | - |
| 63 | + |
64 | 64 | $ncrank = current( $aliasBallot ); // current() return the next element for an array alias inside a foreach() |
65 | | - if( $ncrank ) { |
| 65 | + if ( $ncrank ) { |
66 | 66 | $vote .= ( $crank < $ncrank ) ? "," : ""; |
67 | 67 | } |
68 | 68 | } |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | |
84 | 84 | $orderedCandidates = sort_candidate_by_wins( $boardCandidates, $beatpathWVMatrix, $beatpathMMatrix ); |
85 | 85 | |
86 | | -### Output results ### |
| 86 | +# ## Output results ### |
87 | 87 | fwrite( $vfs, "== Pairwise defeats matrix ==\n" ); |
88 | 88 | output_table( $vfs, $defeatMatrix ); |
89 | 89 | fwrite( $vfs, "\nFor the above table, a row beats a column by N votes.\n\n" . |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | |
104 | 104 | fclose( $vfs ); |
105 | 105 | |
106 | | -#----------------------------------------------------------- |
| 106 | +# ----------------------------------------------------------- |
107 | 107 | |
108 | 108 | function process_line( $line ) { |
109 | 109 | $importantBit = substr( $line, strpos( $line, ":" ) + 1 ); |
— | — | @@ -111,8 +111,8 @@ |
112 | 112 | foreach ( $set as $i ) { |
113 | 113 | $rank = substr( $i, strpos( $i, "[" ) + 1 ); |
114 | 114 | $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; |
117 | 117 | // ^^^ |
118 | 118 | // '[',']' |
119 | 119 | } |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | $defeats[ $c ][ $opp ] = 0; |
129 | 129 | } |
130 | 130 | } |
131 | | - |
| 131 | + |
132 | 132 | foreach ( $ballots as $ballot ) { |
133 | 133 | foreach ( $ballot as $candidate => $rank ) { |
134 | 134 | foreach ( $ballot as $opponent => $oppRank ) { |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
143 | | - |
| 143 | + |
144 | 144 | return $defeats; |
145 | 145 | } |
146 | 146 | |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | $matrix[ $c ][ $opp ] = 0; |
152 | 152 | } |
153 | 153 | } |
154 | | - |
| 154 | + |
155 | 155 | foreach ( $defeats as $candidate => $opponents ) { |
156 | 156 | foreach ( $opponents as $opponent => $votes ) { |
157 | 157 | if ( $candidate != $opponent ) { |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
165 | | - |
| 165 | + |
166 | 166 | return $matrix; |
167 | 167 | } |
168 | 168 | |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | | - |
| 187 | + |
188 | 188 | return $matrix; |
189 | 189 | } |
190 | 190 | |
— | — | @@ -200,7 +200,7 @@ |
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
204 | | - |
| 204 | + |
205 | 205 | return $paths; |
206 | 206 | } |
207 | 207 | |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | foreach ( $opps as $k => $dummy2 ) { |
214 | 214 | if ( ( $c != $k ) && ( $opp != $k ) ) { |
215 | 215 | if ( ( $wvp[ $c ][ $k ] < $wvp[ $opp ][ $c ] ) || |
216 | | - ( ( $wvp[ $c ][ $k ] == $wvp[ $opp ][ $c ] ) && |
| 216 | + ( ( $wvp[ $c ][ $k ] == $wvp[ $opp ][ $c ] ) && |
217 | 217 | ( $mp[ $c ][ $k ] < $mp[ $opp ][ $c ] ) ) ) { |
218 | 218 | $wvipath = $wvp[ $c ][ $k ]; |
219 | 219 | $mipath = $mp[ $c ][ $k ]; |
— | — | @@ -220,9 +220,9 @@ |
221 | 221 | $wvipath = $wvp[ $opp ][ $c ]; |
222 | 222 | $mipath = $mp[ $opp ][ $c ]; |
223 | 223 | } |
224 | | - |
| 224 | + |
225 | 225 | if ( ( $wvp[ $opp ][ $k ] < $wvipath ) || |
226 | | - ( ( $wvp[ $opp ][ $k ] == $wvipath ) && |
| 226 | + ( ( $wvp[ $opp ][ $k ] == $wvipath ) && |
227 | 227 | ( $mp[ $opp ][ $k ] < $mipath ) ) ) { |
228 | 228 | $wvp[ $opp ][ $k ] = $wvipath; |
229 | 229 | $mp[ $opp ][ $k ] = $mipath; |
— | — | @@ -240,26 +240,26 @@ |
241 | 241 | } |
242 | 242 | |
243 | 243 | $winners = $candidates; |
244 | | - |
| 244 | + |
245 | 245 | foreach ( $candidates as $c => $dummy1 ) { |
246 | 246 | foreach ( $candidates as $opp => $dummy2 ) { |
247 | 247 | if ( $c != $opp ) { |
248 | 248 | if ( ( $wvpaths[ $c ][ $opp ] > $wvpaths[ $opp ][ $c ] ) || |
249 | | - ( ( $wvpaths[ $c ][ $opp ] == $wvpaths[ $opp ][ $c ] ) && |
| 249 | + ( ( $wvpaths[ $c ][ $opp ] == $wvpaths[ $opp ][ $c ] ) && |
250 | 250 | ( $mpaths[ $c ][ $opp ] > $mpaths[ $opp ][ $c ] ) ) ) { |
251 | 251 | unset( $winners[ $opp ] ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | } |
256 | | - |
| 256 | + |
257 | 257 | if ( count( $winners ) > 1 ) { |
258 | 258 | $ties = ""; |
259 | 259 | foreach ( $winners as $wname => $wl ) { |
260 | 260 | $ties .= ( $wname . ", " ); |
261 | 261 | } |
262 | 262 | $ties = substr( $ties, 0, -2 ); |
263 | | - |
| 263 | + |
264 | 264 | print "Ties between : " . $ties . "\n"; |
265 | 265 | } |
266 | 266 | |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | |
274 | 274 | function output_table( &$fs, &$matrix ) { |
275 | 275 | global $boardCandidates; |
276 | | - |
| 276 | + |
277 | 277 | $line = "{| class=\"wikitable\" style=\"text-align:center\"\n|-\n! \n"; |
278 | 278 | foreach ( $boardCandidates as $name => $idx ) { |
279 | 279 | $line .= ( "! " . $idx . "\n" ); |