function output_token($var_prefix = 'humanverify') { global $vbulletin; $kc_o = new KeyCAPTCHA_CLASS($vbulletin->options['keycaptcha_privatekey']); $vn = explode('.', $vbulletin->versionnumber); if ($vn[0] == '3') { $tmpl = '<fieldset class="fieldset"><legend>##task##</legend> <br><input type=hidden value="1" id="humanverify" name="humanverify" /><input type=hidden value="1" id="hash" name="hash" />##keycaptchacode##' . '<noscript>You should turn on JavaScript on your browser. After that please reload the page.' . 'Otherwise you won't be able to post any information on this site.</noscript> <br></fieldset>'; } else { $tmpl = '</div><h3 class="blocksubhead">##task##</h3> <br><div class="section"><input type=hidden value="1" id="humanverify" name="humanverify" /><input type=hidden value="1" id="hash" name="hash" />##keycaptchacode##' . '<noscript>You should turn on JavaScript on your browser. After that please reload the page.' . 'Otherwise you won't be able to post any information on this site.</noscript></div><div> <br>'; } $kc_js = $kc_o->render_js(); if ($vbulletin->options['keycaptcha_onerror'] != '') { $kc_js = str_replace($kc_o->p_kc_session_id . "';", $kc_o->p_kc_session_id . "';document.s_s_c_onerroralert='" . str_replace("'", '"', $vbulletin->options['keycaptcha_onerror']) . "';", $kc_js); } $stout = str_replace('##keycaptchacode##', $kc_js, $tmpl); $stout = str_replace('##task##', $vbulletin->options['keycaptcha_task'], $stout); return $stout; }
/** * Validate the input code * * @access public * @return boolean Validation successful * @since 1.0 */ public function validate() { $private_key = $this->settings['keycaptcha_privatekey']; if (!$private_key) { return ''; } $capcode = $_REQUEST['capcode']; $kc_o = new KeyCAPTCHA_CLASS($private_key); if (!$kc_o->check_result($capcode)) { return false; } return true; }
public function captcha() { switch ($this->config->main['captcha']) { case 1: $content = $this->sp(MCR_THEME_PATH . "captcha/recaptcha.html"); break; case 2: require MCR_TOOL_PATH . 'libs/keycaptcha.php'; $kc = new KeyCAPTCHA_CLASS('', $this); $data["CONTENT"] = $kc->render_js(); $content = $this->sp(MCR_THEME_PATH . "captcha/keycaptcha.html", $data); break; default: return; break; } return $content; }
/** * This event is being triggered by application * on receiveing of the User submitted form, protected by CAPTCHA (Step 2) * @param $secretword string input. - Not used * * @param $Ok boolean output. true if Captcha application successfully * processed the event. */ function onCaptcha_Confirm($secretword, &$Ok) { $Ok = false; $capcode = JRequest::getVar('capcode', ''); $this->params = new JParameter(JPluginHelper::getPlugin('system', 'keycaptcha')->params); // 3.0 //$kc_o = new KeyCAPTCHA_CLASS($this->params->get('keycaptcha_site_private_key')); $kc_o = new KeyCAPTCHA_CLASS($this->params->keycaptcha_site_private_key); if ($kc_o->check_result($capcode)) { $Ok = true; } return $Ok; }