|
@@ -11,7 +11,7 @@ class Form {
|
|
|
return !empty($value) ? "checked" : "";
|
|
return !empty($value) ? "checked" : "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static function checkRecaptcha() {
|
|
|
|
|
|
|
+ public static function checkRecaptcha($required_score = 0.5) {
|
|
|
|
|
|
|
|
if(!defined("GOOGLE_RECAPTCHA_SECRET")) return true;
|
|
if(!defined("GOOGLE_RECAPTCHA_SECRET")) return true;
|
|
|
|
|
|
|
@@ -20,15 +20,17 @@ class Form {
|
|
|
"response" => http::value("g-recaptcha-response"),
|
|
"response" => http::value("g-recaptcha-response"),
|
|
|
"remoteip" => $_SERVER["REMOTE_ADDR"]
|
|
"remoteip" => $_SERVER["REMOTE_ADDR"]
|
|
|
]);
|
|
]);
|
|
|
|
|
+ if(!$json) return false;
|
|
|
|
|
|
|
|
- if($json) {
|
|
|
|
|
- $response = json_decode($json);
|
|
|
|
|
- if($response) {
|
|
|
|
|
- return $response->success;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $response = json_decode($json);
|
|
|
|
|
+ if(!$response) return false;
|
|
|
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ if(isset($response->score)) {
|
|
|
|
|
+ return $response->score >= $required_score;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ return $response->success;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static function renderYearOptions($min = null, $max = null, $selected_value = null) {
|
|
public static function renderYearOptions($min = null, $max = null, $selected_value = null) {
|