diff --git a/public/config-sample.php b/public/config-sample.php
index 3388bc4..475fbe3 100644
--- a/public/config-sample.php
+++ b/public/config-sample.php
@@ -40,6 +40,8 @@ ISQ::$social = array(
// reCAPTCHA API KEYS
// Get yourls from https://www.google.com/recaptcha/admin
+// If you don't want to use reCAPTCHA, that's cool. Leave this empty, and basic
+// antispam protection will be provided.
ISQ::$recaptcha = array(
'sitekey' => '',
'secret' => ''
diff --git a/public/style.css b/public/style.css
index 10e956a..f8f7743 100644
--- a/public/style.css
+++ b/public/style.css
@@ -48,6 +48,10 @@ a, a:visited {
box-shadow: 0 0 3px 0 #CCC;
}
+.hidden {
+ display: none;
+}
+
/* Header */
.site-header {
margin: 0 auto;
diff --git a/result.php b/result.php
index 079b809..a3383ca 100644
--- a/result.php
+++ b/result.php
@@ -3,16 +3,26 @@ $dependencies = array( 'ZeroClipboard' );
include('header.php');
-$recaptcha_data = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . ISQ::$recaptcha['secret'] . '&response=' . $_REQUEST['g-recaptcha-response']);
-$recaptcha_json = json_decode($recaptcha_data, TRUE);
-
-// What happens when the CAPTCHA was completed incorrectly
-if ($recaptcha_json['success'] != 'true') {
- echo '
' . yourls__( 'Are you a bot? Google certainly thinks so. Please go back and try again.', 'isq_translation' ) . '
';
include('footer.php');
die();
}
+if ( !empty(ISQ::$recaptcha['sitekey']) && !empty(ISQ::$recaptcha['secret']) ) {
+ $recaptcha_data = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . ISQ::$recaptcha['secret'] . '&response=' . $_REQUEST['g-recaptcha-response']);
+ $recaptcha_json = json_decode($recaptcha_data, TRUE);
+
+ // What happens when the CAPTCHA was completed incorrectly
+ if ( $recaptcha_json['success'] != 'true' ) {
+ display_error( yourls__( 'Are you a bot? Google certainly thinks you are. Please go back and try again.', 'isq_translation' ) );
+ }
+} else {
+ if ( $_REQUEST['basic_antispam'] != "" ) {
+ display_error( yourls__( 'Are you a bot? The verification was not completed successfully. Please go back and try again.', 'isq_translation' ) );
+ }
+}
+
$url = isset( $_REQUEST['url'] ) ? yourls_sanitize_url( $_REQUEST['url'] ) : '';
$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ) : '' ;
$title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;