[TASK] added Feature #120

This commit is contained in:
Kanti 2014-12-14 18:39:52 +01:00
commit 5eefbe93f8
4 changed files with 39 additions and 2 deletions

View file

@ -1758,3 +1758,24 @@ function remove_html_comments($content)
{
return trim(preg_replace('/(\s|)<!--(.*)-->(\s|)/', '', $content));
}
function isCaptcha($reCaptchaResponse){
if(! config("google.reCaptcha")){
return true;
}
$url = "https://www.google.com/recaptcha/api/siteverify";
$options = array(
"secret" => config("google.reCaptcha.private"),
"response" => $reCaptchaResponse,
"remoteip" => $_SERVER['REMOTE_ADDR'],
);
$fileContent = @file_get_contents($url . "?" . http_build_query($options));
if($fileContent === false) {
return false;
}
$json = json_decode($fileContent, true);
if($json == false){
return false;
}
return ($json['success']);
}