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; }
/** * Gets the challenge HTML (javascript and non-javascript version). * This is called from the browser, and the resulting KeyCAPTCHA HTML widget * is embedded within the HTML form it was called from. * * @access public * @return string Form HTML to display */ public function getTemplate() { $private_key = $this->settings['keycaptcha_privatekey']; if (!$private_key) { return ''; } $kc_o = new KeyCAPTCHA_CLASS($private_key); return $this->registry->output->getTemplate('global_other')->captchaKeycaptcha('<input type="hidden" id="capcode" name="capcode">' . $kc_o->render_js()); }
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 * during rendering of the HTML form to be protected by CAPTCHA (Step 1) * @param $Ok boolean output. true if Captcha application successfully * processed the event. * @param $captchaHtmlBlock string output. HTML block to be inserted into the * HTML form. It MAY contain the 'secretword' form field, * to be returned to the CAPTCHA during confirmation step * (i.e. during Step 2, see #onCaptcha_Confirm) */ function onCaptcha_DisplayHtmlBlock(&$Ok, &$captchaHtmlBlock, $submit_ids = '') { JPlugin::loadLanguage('plg_system_keycaptcha', JPATH_ADMINISTRATOR); $this->params = new JParameter(JPluginHelper::getPlugin('system', 'keycaptcha')->params); // 3.0 //$task_message = $this->params->get('keycaptcha_custom_task_text'); $task_message = $this->params->keycaptcha_custom_task_text; $view = JRequest::getVar('view'); if ($task_message == '') { if ($view == 'register') { $task_message = JText::_('KEYCAPTCHA_TASK_REGISTRATION_MESSAGE'); } else { $task_message = JText::_('KEYCAPTCHA_TASK_COMMON_MESSAGE'); } } //3.0 //$kc_code = $this->params->get('keycaptcha_code'); $kc_code = $this->params->keycaptcha_code; if ($kc_code[strlen($kc_code) - 1] == "'") { $kc_code = substr($kc_code, 0, strlen($kc_code) - 1); } // 3.0 //$kc_o = new KeyCAPTCHA_CLASS($this->params->get('keycaptcha_site_private_key'), str_replace( '#BUTTONS#', $submit_ids, $kc_code ) ); $kc_o = new KeyCAPTCHA_CLASS($this->params->keycaptcha_site_private_key, str_replace('#BUTTONS#', $submit_ids, $kc_code)); $Ok = true; //3.0 //$kc_template = str_replace( '(gt)', '>', str_replace( '(lt)', '<', $this->params->get('keycaptcha_html') ) ); $kc_template = str_replace('(gt)', '>', str_replace('(lt)', '<', $this->params->keycaptcha_html)); if (strpos($kc_template, '#keycaptcha#') == false) { $kc_template = "<br><div id='keycaptcha_div' style='height:220px; padding:0; margin:0; display:table; border:none;'>#keycaptcha#</div>"; } if ($kc_template[strlen($kc_template) - 1] == "'") { $kc_template = substr($kc_template, 0, strlen($kc_template) - 1); } if ($task_message[strlen($task_message) - 1] == "'") { $task_message = substr($task_message, 0, strlen($task_message) - 1); } $captchaHtmlBlock = str_replace('#keycaptcha#', '<table style="padding-top:10px; padding-bottom:10px; border:none; " cellpadding="0" cellspacing="0"> <tr style="border:none;"><td style="border:none;"><input type="hidden" id="capcode" name="capcode" value="false" /> ' . $task_message . '</td></tr><tr style="border:none;"><td style="border:none;" align="center">' . str_replace('(gt)', '>', str_replace('(lt)', '<', $kc_o->render_js())) . '<noscript><b style="color:red;">' . JText::_('KEYCAPTCHA_NOSCRIPT_MESSAGE') . '</b></noscript></td></tr></table>', $kc_template); return $Ok; }