/** * Gets html to display an email address given a public an private key. * to get a key, go to: * * http://www.google.com/recaptcha/mailhide/apikey */ public static function recaptcha_mailhide_html($pubkey, $privkey, $email) { $emailparts = RecaptchaForDekoBoko::_recaptcha_mailhide_email_parts($email); $url = RecaptchaForDekoBoko::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]); }
<input type="hidden" name="dekoboko_action" value="update_options"> <table border="0" cellspacing="3" cellpadding="3" class="form-table"> <tr valign="top"> <td nowrap="nowrap"><?php _e("reCAPTCHA public key:", 'dekoboko'); ?> </td> <td nowrap="nowrap"><input type="text" name="dekoboko_options[public_key]" value="<?php echo $this->settings['public_key']; ?> " size="40" /></td> <td rowspan="2"><strong>«</strong> <?php _e("If you are already using the WP-reCAPTCHA plugin for comments, Deko Boko will copy the API key you've already set. If you are not using the WP-reCAPTCHA plugin for comments, then you need to get a", 'dekoboko'); ?> <a href="<?php echo RecaptchaForDekoBoko::recaptcha_get_signup_url($_SERVER['HTTP_HOST'], 'wordpress'); ?> " target="_blank"><?php _e('free reCAPTCHA API key for your site', 'dekoboko'); ?> </a> <?php _e('and enter the public and private keys here.', 'dekoboko'); ?> </td> </tr> <tr valign="top"> <td nowrap="nowrap"><?php _e("reCAPTCHA private key:", 'dekoboko'); ?> </td>
public function checkFormDataIsSafe() { if (!$this->functionsFacade->checkPublicNonceField($_POST['dekoboko_nonce'], 'dekoboko_nonce')) { $this->submissionErrors[] = "<strong>" . __("Invalid Nonce", 'dekoboko') . "</strong>"; } $recaptchaResponse = RecaptchaForDekoBoko::recaptcha_check_answer($this->settings['private_key'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$recaptchaResponse->is_valid) { $this->submissionErrors[] = "<strong>" . __("ReCAPTCHA error", 'dekoboko') . ":</strong> " . __("your captcha response was incorrect - please try again", 'dekoboko'); } foreach ($this->headersInForm as $header) { if ($this->checkHeaderIsSafe($_POST['dekoboko_required'][$header]) === false) { $this->submissionErrors[] = "<strong>{$header}</strong> " . __("header contains malicious data", 'dekoboko'); } if ($this->checkHeaderIsSafe($_POST['dekoboko_optional'][$header]) === false) { $this->submissionErrors[] = "<strong>{$header}</strong> " . __("header contains malicious data", 'dekoboko'); } } foreach ($_POST['dekoboko_required'] as $k => $v) { if (!strlen($v)) { $this->submissionErrors[] = __("Required field", 'dekoboko') . " <strong>{$k}</strong> " . __("is blank", 'dekoboko'); } if ($k == 'email' && strlen($v)) { if (!$this->functionsFacade->checkEmailHasValidFormat($v)) { $safeToDisplayEmail = $this->functionsFacade->sanitizeString($v); $this->submissionErrors[] = "<strong>{$safeToDisplayEmail}</strong> " . __("is not a valid email address", 'dekoboko'); } } } if (!empty($this->submissionErrors)) { return false; } return true; }