Skip to content

Commit

Permalink
Revert third party modifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tithugues committed Nov 9, 2013
1 parent 1f09a22 commit ca8eb08
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
7 changes: 3 additions & 4 deletions libraries/php-gettext/gettext.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function read($bytes) {
/**
* Reads an array of Integers from the Stream
*
* @param int $count How many elements should be read
* @param int count How many elements should be read
* @return Array of Integers
*/
function readintarray($count) {
Expand All @@ -95,9 +95,8 @@ function readintarray($count) {
/**
* Constructor
*
* @param object $Reader the StreamReader object
* @param boolean $enable_cache Enable or disable caching of strings (default on)
* @return void|boolean
* @param object Reader the StreamReader object
* @param boolean enable_cache Enable or disable caching of strings (default on)
*/
function gettext_reader($Reader, $enable_cache = true) {
// If there isn't a StreamReader, turn on short circuit mode.
Expand Down
42 changes: 17 additions & 25 deletions libraries/plugins/auth/recaptchalib.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@

/**
* Encodes the given data into a query string format
*
* @param array $data array of string elements to be encoded
*
* @return string encoded request
* @param $data - array of string elements to be encoded
* @return string - encoded request
*/
function _recaptcha_qsencode ($data) {
$req = "";
Expand All @@ -60,12 +58,10 @@ function _recaptcha_qsencode ($data) {

/**
* Submits an HTTP POST to a reCAPTCHA server
*
* @param string $host Host
* @param string $path Path
* @param array $data Data
* @param int $port Port
*
* @param string $host
* @param string $path
* @param array $data
* @param int port
* @return array response
*/
function _recaptcha_http_post($host, $path, $data, $port = 80) {
Expand Down Expand Up @@ -101,19 +97,18 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
* is embedded within the HTML form it was called from.
*
* @param string $pubkey A public key for reCAPTCHA
* @param string $error The error given by reCAPTCHA (optional, default is null)
* @param boolean $use_ ssl Should the request be made over ssl? (optional, default is false)
* @param string $pubkey A public key for reCAPTCHA
* @param string $error The error given by reCAPTCHA (optional, default is null)
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
* @return string The HTML to be embedded in the user's form.
* @return string - The HTML to be embedded in the user's form.
*/
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{
if ($pubkey == null || $pubkey == '') {
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>");
}

if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
Expand Down Expand Up @@ -164,8 +159,8 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
}



//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response = new ReCaptchaResponse();
Expand Down Expand Up @@ -201,11 +196,8 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
* gets a URL where the user can sign up for reCAPTCHA. If your application
* has a configuration page where you enter a key, you should provide a link
* using this function.
*
* @param string $domain The domain where the page is hosted
* @param string $appname The name of your application
*
* @return String URL
*/
function recaptcha_get_signup_url ($domain = null, $appname = null) {
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
Expand All @@ -223,7 +215,7 @@ function _recaptcha_aes_encrypt($val,$ky) {
if (! function_exists ("mcrypt_encrypt")) {
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
}
$mode=MCRYPT_MODE_CBC;
$mode=MCRYPT_MODE_CBC;
$enc=MCRYPT_RIJNDAEL_128;
$val=_recaptcha_aes_pad($val);
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
Expand All @@ -240,11 +232,11 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}


$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);

return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}

Expand Down Expand Up @@ -275,7 +267,7 @@ function _recaptcha_mailhide_email_parts ($email) {
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);

return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
"' 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]);

Expand Down

0 comments on commit ca8eb08

Please sign in to comment.