r108711 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108710‎ | r108711 | r108712 >
Date:08:58, 12 January 2012
Author:siebrand
Status:ok
Tags:
Comment:
stylize.php, some indentation fixes and some brackets added.
Modified paths:
  • /trunk/extensions/ConfirmEdit/Asirra.class.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/Captcha.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/CaptchaStore.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEditHooks.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/FancyCaptcha.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/HTMLCaptchaField.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/MathCaptcha.class.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ReCaptcha.class.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ReCaptcha.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/recaptchalib.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmEdit/ReCaptcha.php
@@ -21,7 +21,7 @@
2222
2323 $wgExtensionMessagesFiles['ReCaptcha'] = $dir . '/ReCaptcha.i18n.php';
2424
25 -$wgAutoloadClasses['ReCaptcha']= $dir . '/ReCaptcha.class.php';
 25+$wgAutoloadClasses['ReCaptcha'] = $dir . '/ReCaptcha.class.php';
2626
2727 require_once( 'recaptchalib.php' );
2828
@@ -57,9 +57,9 @@
5858 $wgReCaptchaPrivateKey = $recaptcha_private_key;
5959 }
6060
61 - if ($wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == '') {
62 - die ('You need to set $wgReCaptchaPrivateKey and $wgReCaptchaPublicKey in LocalSettings.php to ' .
 61+ if ( $wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == '' ) {
 62+ die ( 'You need to set $wgReCaptchaPrivateKey and $wgReCaptchaPublicKey in LocalSettings.php to ' .
6363 "use the reCAPTCHA plugin. You can sign up for a key <a href='" .
64 - htmlentities(recaptcha_get_signup_url ($wgServerName, "mediawiki")) . "'>here</a>.");
 64+ htmlentities( recaptcha_get_signup_url ( $wgServerName, "mediawiki" ) ) . "'>here</a>." );
6565 }
6666 }
Index: trunk/extensions/ConfirmEdit/HTMLCaptchaField.php
@@ -33,11 +33,11 @@
3434 */
3535 private $validationResult;
3636
37 - public function __construct( $params ){
 37+ public function __construct( $params ) {
3838 parent::__construct( $params );
3939
4040 // For differentiating the type of form, mainly
41 - if( isset( $params['prefix'] ) ){
 41+ if ( isset( $params['prefix'] ) ) {
4242 $this->prefix = $params['prefix'];
4343 }
4444 }
@@ -48,29 +48,29 @@
4949 * @param $value String
5050 * @return String
5151 */
52 - public function getInputHTML( $value ){
 52+ public function getInputHTML( $value ) {
5353 # TODO
5454 }
5555
56 - public function validate( $data, $alldata ){
 56+ public function validate( $data, $alldata ) {
5757 // We sent back the exists status of the captcha before. If it *doesn't* exist
5858 // we actually want to validate this as true, because we don't want an angry red
5959 // error message, just for the user to put the captcha in again
60 - if( $data === false ){
 60+ if ( $data === false ) {
6161 return true;
6262 }
6363
64 -
 64+
6565 }
6666
6767 /**
6868 * @param $request WebRequest
6969 * @return void
7070 */
71 - public function loadDataFromRequest( $request ){
 71+ public function loadDataFromRequest( $request ) {
7272 $this->captcha = Captcha::factory();
7373 $this->captcha->loadFromRequest( $request, $this );
74 - if( !$this->captcha->exists() ){
 74+ if ( !$this->captcha->exists() ) {
7575 // The captcha doesn't exist; probably because it's already been used and
7676 // then deleted for security. Load the field up with a new captcha which
7777 // will be shown to the user when the validation of said new object fails
Index: trunk/extensions/ConfirmEdit/ReCaptcha.class.php
@@ -1,8 +1,7 @@
22 <?php
33
44 class ReCaptcha extends SimpleCaptcha {
5 -
6 - //reCAPTHCA error code returned from recaptcha_check_answer
 5+ // reCAPTHCA error code returned from recaptcha_check_answer
76 private $recaptcha_error = null;
87
98 /**
@@ -12,10 +11,11 @@
1312 */
1413 function getForm() {
1514 global $wgReCaptchaPublicKey, $wgReCaptchaTheme;
 15+
1616 $useHttps = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' );
1717 $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar( array( 'theme' => $wgReCaptchaTheme, 'tabindex' => 1 ) );
1818
19 - return Html::inlineScript( $js ) . recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps);
 19+ return Html::inlineScript( $js ) . recaptcha_get_html( $wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps );
2020 }
2121
2222 /**
@@ -27,12 +27,12 @@
2828 function passCaptcha() {
2929 global $wgReCaptchaPrivateKey, $wgRequest;
3030
31 - //API is hardwired to return wpCaptchaId and wpCaptchaWord, so use that if the standard two are empty
 31+ // API is hardwired to return wpCaptchaId and wpCaptchaWord, so use that if the standard two are empty
3232 $challenge = $wgRequest->getVal( 'recaptcha_challenge_field', $wgRequest->getVal( 'wpCaptchaId' ) );
3333 $response = $wgRequest->getVal( 'recaptcha_response_field', $wgRequest->getVal( 'wpCaptchaWord' ) );
3434
3535 if ( $response === null ) {
36 - //new captcha session
 36+ // new captcha session
3737 return false;
3838 }
3939
@@ -43,7 +43,7 @@
4444 $response
4545 );
4646
47 - if (!$recaptcha_response->is_valid) {
 47+ if ( !$recaptcha_response->is_valid ) {
4848 $this->recaptcha_error = $recaptcha_response->error;
4949 return false;
5050 }
@@ -56,6 +56,7 @@
5757
5858 function addCaptchaAPI( &$resultArr ) {
5959 global $wgReCaptchaPublicKey;
 60+
6061 $resultArr['captcha']['type'] = 'recaptcha';
6162 $resultArr['captcha']['mime'] = 'image/png';
6263 $resultArr['captcha']['key'] = $wgReCaptchaPublicKey;
@@ -72,6 +73,7 @@
7374 function getMessage( $action ) {
7475 $name = 'recaptcha-' . $action;
7576 $text = wfMsg( $name );
 77+
7678 # Obtain a more tailored message, if possible, otherwise, fall back to
7779 # the default for edits
7880 return wfEmptyMsg( $name, $text ) ? wfMsg( 'recaptcha-edit' ) : $text;
Index: trunk/extensions/ConfirmEdit/Captcha.php
@@ -177,12 +177,12 @@
178178 */
179179 function isIPWhitelisted() {
180180 global $wgCaptchaWhitelistIP;
181 -
 181+
182182 if ( $wgCaptchaWhitelistIP ) {
183183 global $wgRequest;
184 -
 184+
185185 $ip = $wgRequest->getIP();
186 -
 186+
187187 foreach ( $wgCaptchaWhitelistIP as $range ) {
188188 if ( IP::isInRange( $ip, $range ) ) {
189189 return true;
Index: trunk/extensions/ConfirmEdit/ConfirmEdit.php
@@ -191,12 +191,12 @@
192192 $wgHooks['APIGetParamDescription'][] = 'ConfirmEditHooks::APIGetParamDescription';
193193
194194 $wgAutoloadClasses['ConfirmEditHooks'] = "$wgConfirmEditIP/ConfirmEditHooks.php";
195 -$wgAutoloadClasses['SimpleCaptcha']= "$wgConfirmEditIP/Captcha.php";
196 -$wgAutoloadClasses['CaptchaStore']= "$wgConfirmEditIP/CaptchaStore.php";
197 -$wgAutoloadClasses['CaptchaSessionStore']= "$wgConfirmEditIP/CaptchaStore.php";
198 -$wgAutoloadClasses['CaptchaCacheStore']= "$wgConfirmEditIP/CaptchaStore.php";
 195+$wgAutoloadClasses['SimpleCaptcha'] = "$wgConfirmEditIP/Captcha.php";
 196+$wgAutoloadClasses['CaptchaStore'] = "$wgConfirmEditIP/CaptchaStore.php";
 197+$wgAutoloadClasses['CaptchaSessionStore'] = "$wgConfirmEditIP/CaptchaStore.php";
 198+$wgAutoloadClasses['CaptchaCacheStore'] = "$wgConfirmEditIP/CaptchaStore.php";
199199 $wgAutoloadClasses['CaptchaSpecialPage'] = "$wgConfirmEditIP/ConfirmEditHooks.php";
200 -$wgAutoloadClasses['HTMLCaptchaField']= "$wgConfirmEditIP/HTMLCaptchaField.php";
 200+$wgAutoloadClasses['HTMLCaptchaField'] = "$wgConfirmEditIP/HTMLCaptchaField.php";
201201
202202 /**
203203 * Set up $wgWhitelistRead
Index: trunk/extensions/ConfirmEdit/ConfirmEditHooks.php
@@ -1,7 +1,6 @@
22 <?php
33
44 class ConfirmEditHooks {
5 -
65 /**
76 * Get the global Captcha instance
87 *
@@ -9,11 +8,14 @@
109 */
1110 static function getInstance() {
1211 global $wgCaptcha, $wgCaptchaClass;
 12+
1313 static $done = false;
 14+
1415 if ( !$done ) {
1516 $done = true;
1617 $wgCaptcha = new $wgCaptchaClass;
1718 }
 19+
1820 return $wgCaptcha;
1921 }
2022
@@ -63,20 +65,23 @@
6466 }
6567
6668 class CaptchaSpecialPage extends UnlistedSpecialPage {
67 - public function __construct(){
 69+ public function __construct() {
6870 parent::__construct( 'Captcha' );
6971 }
 72+
7073 function execute( $par ) {
7174 $this->setHeaders();
 75+
7276 $instance = ConfirmEditHooks::getInstance();
 77+
7378 switch( $par ) {
74 - case "image":
75 - if ( method_exists( $instance, 'showImage' ) )
76 - return $instance->showImage();
77 - case "help":
78 - default:
79 - return $instance->showHelp();
 79+ case "image":
 80+ if ( method_exists( $instance, 'showImage' ) ) {
 81+ return $instance->showImage();
 82+ }
 83+ case "help":
 84+ default:
 85+ return $instance->showHelp();
8086 }
8187 }
8288 }
83 -
Index: trunk/extensions/ConfirmEdit/CaptchaStore.php
@@ -40,9 +40,9 @@
4141 * @return CaptchaStore
4242 */
4343 public final static function get() {
44 - if( !self::$instance instanceof self ){
 44+ if ( !self::$instance instanceof self ) {
4545 global $wgCaptchaStorageClass;
46 - if( in_array( 'CaptchaStore', class_parents( $wgCaptchaStorageClass ) ) ) {
 46+ if ( in_array( 'CaptchaStore', class_parents( $wgCaptchaStorageClass ) ) ) {
4747 self::$instance = new $wgCaptchaStorageClass;
4848 } else {
4949 throw new MWException( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
@@ -54,7 +54,7 @@
5555 /**
5656 * Protected constructor: no creating instances except through the factory method above
5757 */
58 - protected function __construct(){}
 58+ protected function __construct() {}
5959 }
6060
6161 class CaptchaSessionStore extends CaptchaStore {
Index: trunk/extensions/ConfirmEdit/MathCaptcha.class.php
@@ -39,7 +39,7 @@
4040
4141 /** Fetch the math */
4242 function fetchMath( $sum ) {
43 - if( MWInit::classExists( 'MathRenderer' ) ){
 43+ if ( MWInit::classExists( 'MathRenderer' ) ) {
4444 $math = new MathRenderer( $sum );
4545 } else {
4646 throw new MWException( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
Index: trunk/extensions/ConfirmEdit/recaptchalib.php
@@ -35,22 +35,22 @@
3636 /**
3737 * The reCAPTCHA server URL's
3838 */
39 -define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
40 -define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
41 -define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
 39+define( "RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api" );
 40+define( "RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api" );
 41+define( "RECAPTCHA_VERIFY_SERVER", "www.google.com" );
4242
4343 /**
4444 * Encodes the given data into a query string format
4545 * @param $data - array of string elements to be encoded
4646 * @return string - encoded request
4747 */
48 -function _recaptcha_qsencode ($data) {
 48+function _recaptcha_qsencode ( $data ) {
4949 $req = "";
5050 foreach ( $data as $key => $value )
51 - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
 51+ $req .= $key . '=' . urlencode( stripslashes( $value ) ) . '&';
5252
5353 // Cut the last '&'
54 - $req=substr($req,0,strlen($req)-1);
 54+ $req = substr( $req, 0, strlen( $req ) -1 );
5555 return $req;
5656 }
5757
@@ -64,29 +64,29 @@
6565 * @param int port
6666 * @return array response
6767 */
68 -function _recaptcha_http_post($host, $path, $data, $port = 80) {
 68+function _recaptcha_http_post( $host, $path, $data, $port = 80 ) {
6969
70 - $req = _recaptcha_qsencode ($data);
 70+ $req = _recaptcha_qsencode ( $data );
7171
7272 $http_request = "POST $path HTTP/1.0\r\n";
7373 $http_request .= "Host: $host\r\n";
7474 $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
75 - $http_request .= "Content-Length: " . strlen($req) . "\r\n";
 75+ $http_request .= "Content-Length: " . strlen( $req ) . "\r\n";
7676 $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
7777 $http_request .= "\r\n";
7878 $http_request .= $req;
7979
8080 $response = '';
81 - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
82 - die ('Could not open socket');
 81+ if ( false == ( $fs = @fsockopen( $host, $port, $errno, $errstr, 10 ) ) ) {
 82+ die ( 'Could not open socket' );
8383 }
8484
85 - fwrite($fs, $http_request);
 85+ fwrite( $fs, $http_request );
8686
87 - while ( !feof($fs) )
88 - $response .= fgets($fs, 1160); // One TCP-IP packet
89 - fclose($fs);
90 - $response = explode("\r\n\r\n", $response, 2);
 87+ while ( !feof( $fs ) )
 88+ $response .= fgets( $fs, 1160 ); // One TCP-IP packet
 89+ fclose( $fs );
 90+ $response = explode( "\r\n\r\n", $response, 2 );
9191
9292 return $response;
9393 }
@@ -103,26 +103,26 @@
104104
105105 * @return string - The HTML to be embedded in the user's form.
106106 */
107 -function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
 107+function recaptcha_get_html ( $pubkey, $error = null, $use_ssl = false )
108108 {
109 - if ($pubkey == null || $pubkey == '') {
110 - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
 109+ if ( $pubkey == null || $pubkey == '' ) {
 110+ die ( "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>" );
111111 }
112112
113 - if ($use_ssl) {
 113+ if ( $use_ssl ) {
114114 $server = RECAPTCHA_API_SECURE_SERVER;
115115 } else {
116116 $server = RECAPTCHA_API_SERVER;
117117 }
118118
119119 $errorpart = "";
120 - if ($error) {
 120+ if ( $error ) {
121121 $errorpart = "&amp;error=" . $error;
122122 }
123 - return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
 123+ return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
124124
125125 <noscript>
126 - <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
 126+ <iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
127127 <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
128128 <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
129129 </noscript>';
@@ -149,27 +149,27 @@
150150 * @param array $extra_params an array of extra variables to post to the server
151151 * @return ReCaptchaResponse
152152 */
153 -function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
 153+function recaptcha_check_answer ( $privkey, $remoteip, $challenge, $response, $extra_params = array() )
154154 {
155 - if ($privkey == null || $privkey == '') {
156 - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
 155+ if ( $privkey == null || $privkey == '' ) {
 156+ die ( "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>" );
157157 }
158158
159 - if ($remoteip == null || $remoteip == '') {
160 - die ("For security reasons, you must pass the remote ip to reCAPTCHA");
 159+ if ( $remoteip == null || $remoteip == '' ) {
 160+ die ( "For security reasons, you must pass the remote ip to reCAPTCHA" );
161161 }
162162
163163
164164
165 - //discard spam submissions
166 - if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
 165+ // discard spam submissions
 166+ if ( $challenge == null || strlen( $challenge ) == 0 || $response == null || strlen( $response ) == 0 ) {
167167 $recaptcha_response = new ReCaptchaResponse();
168168 $recaptcha_response->is_valid = false;
169169 $recaptcha_response->error = 'incorrect-captcha-sol';
170170 return $recaptcha_response;
171171 }
172172
173 - $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
 173+ $response = _recaptcha_http_post ( RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
174174 array (
175175 'privatekey' => $privkey,
176176 'remoteip' => $remoteip,
@@ -178,10 +178,10 @@
179179 ) + $extra_params
180180 );
181181
182 - $answers = explode ("\n", $response [1]);
 182+ $answers = explode ( "\n", $response [1] );
183183 $recaptcha_response = new ReCaptchaResponse();
184184
185 - if (trim ($answers [0]) == 'true') {
 185+ if ( trim ( $answers [0] ) == 'true' ) {
186186 $recaptcha_response->is_valid = true;
187187 }
188188 else {
@@ -199,45 +199,45 @@
200200 * @param string $domain The domain where the page is hosted
201201 * @param string $appname The name of your application
202202 */
203 -function recaptcha_get_signup_url ($domain = null, $appname = null) {
204 - return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
 203+function recaptcha_get_signup_url ( $domain = null, $appname = null ) {
 204+ return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode ( array ( 'domains' => $domain, 'app' => $appname ) );
205205 }
206206
207 -function _recaptcha_aes_pad($val) {
 207+function _recaptcha_aes_pad( $val ) {
208208 $block_size = 16;
209 - $numpad = $block_size - (strlen ($val) % $block_size);
210 - return str_pad($val, strlen ($val) + $numpad, chr($numpad));
 209+ $numpad = $block_size - ( strlen ( $val ) % $block_size );
 210+ return str_pad( $val, strlen ( $val ) + $numpad, chr( $numpad ) );
211211 }
212212
213213 /* Mailhide related code */
214214
215 -function _recaptcha_aes_encrypt($val,$ky) {
216 - if (! function_exists ("mcrypt_encrypt")) {
217 - die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
 215+function _recaptcha_aes_encrypt( $val, $ky ) {
 216+ if ( ! function_exists ( "mcrypt_encrypt" ) ) {
 217+ die ( "To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed." );
218218 }
219 - $mode=MCRYPT_MODE_CBC;
220 - $enc=MCRYPT_RIJNDAEL_128;
221 - $val=_recaptcha_aes_pad($val);
222 - return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
 219+ $mode = MCRYPT_MODE_CBC;
 220+ $enc = MCRYPT_RIJNDAEL_128;
 221+ $val = _recaptcha_aes_pad( $val );
 222+ return mcrypt_encrypt( $enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" );
223223 }
224224
225225
226 -function _recaptcha_mailhide_urlbase64 ($x) {
227 - return strtr(base64_encode ($x), '+/', '-_');
 226+function _recaptcha_mailhide_urlbase64 ( $x ) {
 227+ return strtr( base64_encode ( $x ), '+/', '-_' );
228228 }
229229
230230 /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
231 -function recaptcha_mailhide_url($pubkey, $privkey, $email) {
232 - if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
233 - die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
234 - "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
 231+function recaptcha_mailhide_url( $pubkey, $privkey, $email ) {
 232+ if ( $pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null ) {
 233+ die ( "To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
 234+ "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>" );
235235 }
236236
237237
238 - $ky = pack('H*', $privkey);
239 - $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
 238+ $ky = pack( 'H*', $privkey );
 239+ $cryptmail = _recaptcha_aes_encrypt ( $email, $ky );
240240
241 - return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
 241+ return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ( $cryptmail );
242242 }
243243
244244 /**
@@ -245,15 +245,15 @@
246246 * eg, given johndoe@example,com return ["john", "example.com"].
247247 * the email is then displayed as john...@example.com
248248 */
249 -function _recaptcha_mailhide_email_parts ($email) {
250 - $arr = preg_split("/@/", $email );
 249+function _recaptcha_mailhide_email_parts ( $email ) {
 250+ $arr = preg_split( "/@/", $email );
251251
252 - if (strlen ($arr[0]) <= 4) {
253 - $arr[0] = substr ($arr[0], 0, 1);
254 - } elseif (strlen ($arr[0]) <= 6) {
255 - $arr[0] = substr ($arr[0], 0, 3);
 252+ if ( strlen ( $arr[0] ) <= 4 ) {
 253+ $arr[0] = substr ( $arr[0], 0, 1 );
 254+ } elseif ( strlen ( $arr[0] ) <= 6 ) {
 255+ $arr[0] = substr ( $arr[0], 0, 3 );
256256 } else {
257 - $arr[0] = substr ($arr[0], 0, 4);
 257+ $arr[0] = substr ( $arr[0], 0, 4 );
258258 }
259259 return $arr;
260260 }
@@ -264,12 +264,12 @@
265265 *
266266 * http://www.google.com/recaptcha/mailhide/apikey
267267 */
268 -function recaptcha_mailhide_html($pubkey, $privkey, $email) {
269 - $emailparts = _recaptcha_mailhide_email_parts ($email);
270 - $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
 268+function recaptcha_mailhide_html( $pubkey, $privkey, $email ) {
 269+ $emailparts = _recaptcha_mailhide_email_parts ( $email );
 270+ $url = recaptcha_mailhide_url ( $pubkey, $privkey, $email );
271271
272 - return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
273 - "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
 272+ return htmlentities( $emailparts[0] ) . "<a href='" . htmlentities ( $url ) .
 273+ "' onclick=\"window.open('" . htmlentities ( $url ) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ( $emailparts [1] );
274274
275275 }
276276
Index: trunk/extensions/ConfirmEdit/FancyCaptcha.php
@@ -43,8 +43,8 @@
4444
4545 /**
4646 * By default the FancyCaptcha rotates among all available captchas.
47 - * Setting $wgCaptchaDeleteOnSolve to true will delete the captcha
48 - * files when they are correctly solved. Thus the user will need
 47+ * Setting $wgCaptchaDeleteOnSolve to true will delete the captcha
 48+ * files when they are correctly solved. Thus the user will need
4949 * something like a cron creating new thumbnails to avoid drying up.
5050 */
5151 $wgCaptchaDeleteOnSolve = false;
Index: trunk/extensions/ConfirmEdit/Asirra.class.php
@@ -34,7 +34,7 @@
3535
3636 $ticket = $wgRequest->getVal( 'Asirra_Ticket' );
3737 $api = 'http://challenge.asirra.com/cgi/Asirra?';
38 - $params = array(
 38+ $params = array(
3939 'action' => 'ValidateTicket',
4040 'ticket' => $ticket,
4141 );

Status & tagging log